How to Switch Title Tokens in WordPress

I wanted to switch my blog’s title tag to go from:

Thu Tu’s Blog > Post Title


Post Title | Thu Tu’s Blog

It turned out that it wasn’t as simple as switching the tokens around in the theme’s header.php file.

I did a search and found the solution here.

When I copied and pasted the example code, I got a parse error. It turned out that the blogger had changed the ' to `. If you want to copy and paste code, here’s what I’m using:

<title><?php wp_title(' '); ?><?php if(wp_title(' ', false)) { echo ' | '; } ?><?php bloginfo('name'); ?></title>

Since I use Google Custom Search Engine for my blog search, this would really improve the experience of searching for a post since the title will be the left-most element instead of the blog’s name.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>