Customized Title Optimization – Wordpress Plugin Alternative

A typical title in the standard (Kubrick) Wordpress theme looks like:

Blogname » Title of Post

Unless you explicitely like to brand your blogname, that’s not a search engine friendly title.

I’d rather have the title of the post as my page title.
As an option, it could be followed by the blogname, so that branding still takes place, but personally I prefer not to include that.

There are Wordpress Plugins that will do the trick. And many are added frequently. If you prefer the plugin-route, just do a search on Wordpress Plugin Meta or visit Wordpress or Wordpress Plugin Database.

When I started blogging, these plugins weren’t available, so I created my own title optimization alternative.
And I still use it today. I’m very happy with it, because I’m in control and don’t need yet another pluging (have so many already).

Here’s how it works.

In the theme directory find the file called header.php.
In there, find this line:

<title><?php bloginfo(‘name’); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>

and replace that by:

<title><?php $title = wp_title( ”, false ); if (!$title) {bloginfo(‘name’); } else {wp_title();} ?></title>

This line of code simply says, that if there isn’t a post title, it should display the blogname, otherwise the title.

Now, the standard Wordpress theme doesn’t include description and keyword Meta Tags.
We can easily add these right below the line we just pasted in:

<meta name=”description” content=”<?= bloginfo(‘name’)?> presents <?php $title = wp_title( ”, false ); if ($title) {wp_title(); echo ” “;} ?>and other xxxx topics. ” />
<meta name=”keywords” content=”<?php $title = wp_title( ”, false ); if ($title) {wp_title(); echo “, “;} ?>xxxx” />

Replace xxxx by your main keyword. Upload header.php and your Meta Tags will exactly fit the title of your post.

Easy uh?

Unfortunately Wordpress inserts a » (right angled quote) before every title and I don’t like it. To delete that, you have to find the general-template.php file under wp-includes.

In that page, find function wp_title($sep = ‘&raquo;’, $display = true)
In that function, find these two lines:

if ( !empty($title) )
$prefix = ” $sep “;

and comment them like this:
// if ( !empty($title) )
// $prefix = ” $sep “;

Upload the file again and the right angle quote is gone.

Done, in less than 5 minutes!

Special Note: when upgrading your Wordpress version, don’t forget to save the Wordpress theme folder (and the general-template.php file under wp-includes) and upload it again after upgrading.

That’s how I customize my Wordpress titles and, on the fly, the description and keyword meta tags.
Your thoughts?

Related Articles:


1. You should follow me on Twitter Here

2. Then, you can RETWEET this Post

3. Share this post by clicking the button:


Warning: Invalid argument supplied for foreach() in /home1/afforde4/public_html/wp-content/plugins/twittercall.php on line 16
Recommended Products:

2 Responses to “Customized Title Optimization – Wordpress Plugin Alternative”

  1. psyphil says:

    I have no answer for this good use of brain but this …

    Title Optimization

  2. The default Wordpress page title schema definitely needs to be changed right away.

    There is a plugin called All-In-One SEO Pack that once installed allows you to easily change/configure the titles and meta tags of your pages.

    Also, after you install it the default settings are to have the post names first in the title, followed by the pipe character, followed by your blog name.

    If you dabble in keyword sniping or your blog name contains good keywords then this plugin will help you immensely.