There are a few plugins out there to give you greater ease over your page titles - SEO Title Tag, All-in-one SEO pack are just a couple of the more popular ones.
However, I don’t believe a standard blog necessarily needs these unless you have more than the basic static pages, as your post titles should be sufficiently well written anyway. The one page that does need a good title is your front page, yet for some reason the developers of the 2 templates that come with WordPress seem to have neglected this thought as both only output the blog name for the front page. The code is pretty similar for both templates:
Default Template:
< ?php bloginfo('name'); ?> < ?php if ( is_single() ) { ?> » Blog Archive < ?php } ?> < ?php wp_title(); ?>
Classic Template:
< ?php bloginfo('name'); ?>< ?php wp_title(); ?>
The only difference here is that the default template also adds » Blog Archive on the individual post pages, however otherwise the order is Blog Name » Post Title. You’ll find a few developers have altered their template to put these two elements the other way around creating » Post Title - Blog Name, which is better but why have the right angled quote at the start of the title when you don’t need to? Also the front page will still only have the Blog name.
Fix the Post Title
So first off we’ll fix the post title and stop it outputting the right angled quote ie. ». This is easily done by modifying the wp_title() tag. Since WordPress v2.5 you can specify not only the separator but which side of the post/page title the separator will display.
wp_title() accepts up to 3 parameters - the separator, TRUE/FALSE for whether to echo the title out or return it as a string variable (for use with further scripting) and the location of where to put the separator eg.
wp_title('-', TRUE, 'right'); // would give 'Post Title - '
For pre v2.5 users (and this can work for v2.5 users too) the separator will only print out to the left of the post title, so to achieve the same as above you’d use:
wp_title(''); echo " - ";
By passing an empty parameter to the wp_title() tag you’re effectively saying ‘no separator’ and then you would just echo the hypen out afterwards. Note the difference between wp_title(); and wp_title(”);, the first will add the default » the second will not add any separator.
So to put this together with the blog name you would have:
<title>< ?php wp_title('-', TRUE, 'right'); bloginfo('name'); ?></title>
This is, in my opinion, the best option to have for all of your pages. You’ll have the unique post title first, followed by the site name.
Enhance the Front Page
As mentioned, the wp_title() tag has no affect on the front page, as the front page doesn’t have a post title to display (unless of course it’s a static front page which would use the title for that page). So we need to check that the page is the front page first, and if it is then display an additional bit of text before the blog name.
To check that the page you’re on is the front page we can use the is_home() conditional tag. This will return true if the page you’re on is the front blog page or subsequent page 2, 3 etc. (note this doesn’t work on a static front page). So we can update the title to be:
<title>< ?php if (is_home()) :
echo "Your front page intro here - ";
else :
wp_title('-', TRUE, 'right');
endif;
bloginfo('name'); ?></title>
This would display Your front page intro here - Blog Name for your front page, and Post/Category/Archive title - Blog name for all internal pages.
However, we can take this one step further, especially for those who want to easily change your title, or perhaps the blog is for someone who doesn’t even know what FTP is
We can use the blog description to control the first part of the title ie.
<title>< ?php if (is_home()) :
bloginfo('description');
else :
wp_title('');
endif;
echo " - ";
bloginfo('name'); ?></title>
This means that you can easily update your front page title by updating your description and/or blog name without the need to edit the theme files.
Category, Tags and Archive Pages
If you want to use a similar method for your category and archive pages then you can use is_category(), is_tag() and is_archive() conditional tags within your index.php template file to then determine which page the user is on. Alternatively you can use the template hierarchy to have a separate template file for categories, archives and tags.






















Ed Hardy | May 19th, 2008 at 3:33 am #
I think that using the SEO plugins really help a lot for blogs. Without it my blog was getting very little traffic. Now that I installed it google spidered my site and ranked all my posts!
Jordan | May 19th, 2008 at 9:58 am #
Thank you for spreading the word about the stupid “Blog Archive” tag. It’s annoying for bookmarking AND for posting on Tumblr.
When I’m bookmarking a post on any given blog, I don’t care whether it’s in your “blog archive.” What difference does that make? The point of the Title is to show the name of the page that you’re on, not to help categorize the page. Use categories for this purpose, not titles. “Archive” is implied, and completely superfluous. (Consider: who needs to know that this is your blog archive? What is a “blog archive,” considering that everything posted is in the archive? Doesn’t that make the blog itself an archive?)
Second, when posting to Tumblr, the bookmarklet grabs the title tag to use for the link. To make my tumblog look uniform, I almost ALWAYS have to change the title around to this format: “Post Title - Site”. The only sites that seem to do this properly are CNN and Yahoo!. If they do it in this format, why shouldn’t you?
Why this is important: all blog writers are looking to increase their readership. Having people post your link on Tumblr helps increase your search engine rankings and your visibility. But anything that makes it more difficult for me to add your post is a general pain in my rear and makes me want to post your link less. Remove the barrier and stop with this completely useless “Blog Archive” tag. It doesn’t benefit you, or the reader.
Good post, Sarah!