Changing Your WordPress Titles to [document title] — [site title] Format

This SEO tips post, for tip number 2 says:

Short relevant TITLE = must. Don’t put “news”, “home page”, or other such stuff in the title tag. Format: [document title] – [site title]

So, assuming this advice is valid, I went ahead and made the change to this website. Here’s how I did it in case anyone else finds it non-obvious.

First I’ll show you the new code to use and then I’ll walk you through how to use it.

Here is the new code:

<title><?php if ( is_home() ) { bloginfo('name'); ?>&raquo; <?php bloginfo('description'); } else {wp_title(' ');if(wp_title(' ', false)) { echo '--'; }bloginfo('name');} ?></title>

(Sorry about having no new lines, I’m PHP naive and don’t know how that would affect things.)

Here’s how to change it in your own WordPress blog.

First copy that code into your clipboard.

Next follow the steps illustrated in these pictures:

Go to your blog:
Changing WordPress Title0.png

Go to the administration area:
Changing WordPress Title1.png

Select Presentation:
Changing WordPress Title2.png

Select Theme Editor:
Changing WordPress Title3.png

Select the Header file:
Changing WordPress Title4.png

Replace the title code:
Changing WordPress Title5.png

Finally, hit the update file button on the same page, and you’re done.

Details
If you’re curious how the code works, it says, if it’s the homepage, print blog name followed by blog description, otherwise print document title followed by — followed by blog name and if the document title is blank, just print the blog name, i.e. no –.

If you are wanting to make your own code, this WordPress documentation page dealing with wp title should help.

[tags]wordpress, wordpress and seo, wordpress seo, title, tutortial, howto[/tags]

Comments are closed.