Reverse Blog Name and Post Title in WordPress Title
I thought that it’d look a bit nicer with “Some Post Title — Timblog” as the HTML document’s title instead of “Timblog — Some Post Title”. As a reflex, I went to the WordPress Codex and checked for the functions’ syntax. They had example code for reversing the blog’s name (”Timblog”) and the post’s title (”Some Post Title”):
wp_title(' '); if(wp_title(' ', false)) { echo '--'; } bloginfo('name');
However, you should use the trinary operator (A ? B : C) whenever you can, because it’s so cool. I’d prefer this code:
wp_title(' '); echo ( wp_title( ' ', false ) ? '--' : '' ); bloginfo( 'name' );

Thanks. I added the code in my site.
Comment by Ed — October 31, 2006 @ 3:13 am
Excellent, I was looking for this code. Lets see if i see good results in traffic with this.
Comment by Ted — April 22, 2007 @ 2:20 pm
[...] timjoh.com [...]
Pingback by Homepage titles - make it relevant [FitForFreedom] — May 20, 2007 @ 12:32 pm
[...] Reverse Blog Name and Post Title in WordPress Title [...]
Pingback by Homepage titles - make it relevant » MarcoRichter.net — September 17, 2007 @ 2:26 pm
[...] http://timjoh.com/reverse-blog-name-and-post-title-in-wordpress-title/ [...]
Pingback by http://timjoh.com/reverse-blog-name-and-post-title-in-wordpress-title/ — March 31, 2008 @ 11:23 am