php - Allowed to use a second if statement? -



php - Allowed to use a second if statement? -

am allowed utilize sec "if" statement @ end of existing if statement?

i using "code a" create conditional title tags wordpress website. originally, "code a" did not include "code b", read utilize "code b" adding towards end of existing if statement. "code a" correct?

example of output of code a: category "chicken" , website name "recipes" , "page 3":

title displayed in browser: chicken - recipes - page 3

. code a

<title> <?php if (is_category()) { wp_title(''); echo ' - '; } elseif (function_exists('is_tag') && is_tag()) { single_tag_title(); echo ' - '; } elseif (is_archive()) { wp_title(''); echo ' archive - '; } elseif (is_page()) { echo wp_title(''); echo ' - '; } elseif (is_search()) { echo 'search &quot;'.wp_specialchars($s).'&quot; - '; } elseif (!(is_404()) && (is_single()) || (is_page())) { wp_title(''); echo ' - '; } elseif (is_404()) { echo 'not found - '; } if (is_home()) { bloginfo('name'); echo ' - '; bloginfo('description'); } else { bloginfo('name'); } if ($paged>1) { echo ' - page '. $paged; } ?> </title>

. code b: instructions copied website:

another suggestion, i’m still tinkering titles add together page number end of title if archive or whatever has multiple pages. way avoid duplicate titles (which apparently not advisable search engines).

the code used simple:

if ($paged>1) { echo '- page ', $paged; }

i set code right @ end after else.

yes, code correct. receiving kind of error? thing might want remove "echo" in front end of 3rd wp_title() call.

php wordpress if-statement

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -