Perfecting Your WordPress Title Tags

WordPress logoWordPress‘ default theme (Kubrick) is great, but I’ve always had a problem with the title tags that the Kubrick theme generates. They could be so much more search engine friendly, don’t you think?

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

This usually results in the title reading like Interweb World » Perfecting WordPress Title Tags, which is fine.

But isn’t it better to serve the title tags with the title of the article first? That’s the key information, not what website it came from. And that title tag is what’s going to be used in people’s browser favourites, search engine results and social bookmarking services (, Digg, Stumbleupon, etc).

Improving your Blog Titles

I’ve opted for a simple bit of code which you can see below. Basically, for the homepage (is_home()), we want to display the Blog Name and it’s description or strapline. Then, for every other page (category pages included), we want the title to show up first, then the site name.

	<?php if (is_home()) { ?>

		<?php bloginfo(’name’); ?> &raquo; <?php bloginfo(’description’); ?>
	<?php } else { ?>
		<?php wp_title(”); ?> &raquo; <?php bloginfo(’name’); ?>

	<?php } ?>

Looking good. Test this out on your own blog and see how you get on.

Modifying Title Tags for UltimateTagWarrior

If like me you use Christine Davis’ Ultimate Tag Warrior plugin for internal tagging, add the code below (just after the is_home() condition) and your tag pages will have the same effect.

	<?php } elseif (is_tag()) { ?>
		<?php UTW_ShowCurrentTagSet("", array(’first’=>’%tagdisplay%’, ‘default’=>’, %tagdisplay%’, ‘last’=>’ %operatortext% %tagdisplay%’)); ?> &raquo; <?php bloginfo(’name’); ?>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s