Hi, I modified my wordpress header.php to have the title displayed like this: <title><?php single_post_title()?><?php single_cat_title()?> - <?php bloginfo('name')?> </title> PHP: So if the user is looking at just a category it will display the categorytitle - blogtitle, if they are looking at a permalink then it will have posttitle - blogitle This works like a charm however one little problem I ran into is when there is neither a category, nor a permalink, such as when the website is loaded for the first time, the title becomes - blogtitle. The probelm is that I don't want that dash to be there if there is nothing in front of it to display. So I was thinking is there any way to incorporate the dash only if single_post_title or single_cat_title are present?
Something like this... <title><?if ( ( $pt = single_post_title () ) || ( $pt = single_cat_title () ) ):?><?=$pt;?> - <?endif?><?=bloginfo ( 'name' );?></title> PHP: jb
My advice was wrong, see next post It looks good, except you want to use '==' instead of '=' in the if. Like this... <title><?if ( ( $pt == single_post_title () ) || ( $pt == single_cat_title () ) ):?><?=$pt;?> - <?endif?><?=bloginfo ( 'name' );?></title> PHP:
This way only permalink title works, all others have just - blogtitle THe way with single = everything works but there is no - anywhere. Hmm, not sure how the if statements work here. Does blogger assume if those variables have 0 characters than the if statement returns false?