navigate

categories

Reformatting wp_title()

As you all know WordPress generate its pages with matching titles according to the page contents. It uses the wp_title() tag to accomplish this simple task.

Now in search of a better way to boost our pages for search engine optimization, I decided that the original format that comes with WordPress is a little obsolete:

< ?php bloginfo('name'); ?> < ?php if ( is_single() ) { ?> » Blog Archive < ?php } ?> < ?php wp_title(); ?>

This prints the blog’s name first, then adds the words “Blog Archive” and finally prints the most crucial part of the equation, the post title.

I decided to print the post title first, so that Google would have the keywords in it indexed first, not last. So here’s what I did:

< ?php wp_title(''); ?>< ?php if ( is_home() ) { } else { ?> - < ?php } ?>< ?php bloginfo('name'); ?>

It’s not rocket science but I believe this will help boost your SEO as Google will find your permalinks and WordPress generated pages with its title first instead of your blog name.

PS: This won’t affect your front page as it doesn’t have any post titles on it.

4 comments on “Reformatting wp_title()”

  1. ExtremeLee says:

    Genius. Pure genius! :)

  2. JErm says:

    The code or the idea? :-P

  3. ExtremeLee says:

    The idea, i’m using it on my site :)

  4. Patrick Smith says:

    Thanks for the great tip. I implemented it at my sites.

say something...