How To Optimize The Title Of Your WordPress Blog
In one my previous articles I was telling you that you should not bother too much with SEO for WordPress, because if your blog will be a success, it will not happen thanks to Google, but thanks to social websites, thanks to your social skills, word of mouth and thanks to how interesting your posts really are.
However, you should not ignore to optimize your WordPress theme under any circumstances.
For this post I consider you have a basic understanding and knowledge of SEO, so you know a few HTML tags and a basic understanding of PHP. If not, feel free to ask me, I will be happy to help. Also, copy/paste abilities help a lot!
So, here it is, a short tip on how to optimize the title of your WordPress blog!
I start by telling you that one of the most important ON PAGE optimization factors is the H1 tag, the title of rank 1.
By default, what would I call THE MAIN TITLE of your blog, the one that you set in in the settings of your blog is H1 everywhere, so if the name of your blog is Custom WordPress themes(as you set it in the Settings page on your blog), this will be set as H1 everywhere, no matter you are looking at the first page of your blog or you are looking at one of the post, in detail or at a page. This way you will have the same H1 everywhere. This is not good since it will be seen as duplicated title. It should be different on every page.
What you should do is change it so when you read a post in details, the title of the post to be H1 and not the main title of the blog. For my blogs I usually do this and I only let the main title of the blog as H1 in the index page.
This could be done easily, requires a minimum understanding of PHP and HTML.
The part that you need to change is inside the header file of your theme. Look for the header.php file in your theme folder and inside it look for <?php bloginfo(’name’); ?>. Just search for it.
That’s the very name of the blog and it is enclosed in H1 tags. It gets displayed every time a page of your blog is open and it is the most important tag on that page. You wouldn’t want it to be the same everywhere, would you?
So what you should do is display it as H1 only when it appears in the home page. WordPress helps you with that info so you don’t need to look for it very much, there is a function called is_home() which tests to see if the page is the index page or not.
So you should look for a code similar to this one:
<h1><a href=”<?php echo get_option(’home’); ?>/”><?php bloginfo(’name’); ?></a></h1>
You can change it to look like this:
<?php
if(is_home())
{
?>
<h1><a href=”<?php echo get_option(’home’);?>/”><?php bloginfo(’name’); ?></a></h1>
<?php
}
else
{
?>
<a href=”<?php echo get_option(’home’); ?>/”><?php bloginfo(’name’); ?></a>
<?php
}
?>
Notice how in the first case, the name of the blog was enclosed between H1 tags, while in the second case there is no H1 tags.
All you need to do is enclose the title of the post between H1 tags in the single.php page.
So, go to single.php, look for something similar to <a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></a> and enclose it between H1, so it would look like this:
<h1><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></a></h1>
That’s about it!
Was it hard?
PS: After changing this, probably there will be a change in the way the title of your blog will look so you would need to have a CSS class to make the title of your blog, without the H1, look like it would have H1 around it so the site look consistent everywhere. I will explain about it soon.
Also check these similar posts









November 6th, 2008 at 7:54 pm
By default, WordPress is not optimized for search engines. With this easy change you can get a big result in minutes! It s all about copy/paste
November 28th, 2008 at 9:50 pm
I am very confused, its not ur fault its because I am new to wordpress and coding. My header and single.php look very different and couldn’t find those lines. Could you please help me? Can I send you my header and single page code so that you could just tell me if its the right format?
November 28th, 2008 at 11:48 pm
Leon, those lines I am speaking about are in the header file. By replacing the code this way, only in header file, you help the code make the difference between index.php and single.php
Index.php is asked every time you look at the main page of the blog, where the most recent 10 posts are displayed while single.php is called when you view a post in detail.Try to look for those lines in the header.php, I am sure you can find them. OK, send me the files and I will help you.
November 29th, 2008 at 8:30 am
Thanks a lot Ovidiu, I just sent you the code:)
April 29th, 2009 at 2:47 pm
Hi Ovidiu,
Can you tell me which part of this code I need to change to optimize my titles. Thanks!
<a href=”/” title=”"><img alt=”" src=”/images/only_golf_deals.jpg”>