
I can’t believe how many wordpress themes out their tag themselves as seo-friendly and some even have seo in their theme name and they don’t even do the #1 most important use of the h1 tag. Do yourself a favour if you’re a theme designer and use the following:
The h1 tag should be used for the blog title or blog description but only on the home page. On all other pages, we should relegate it to a h2 at most and put more relevance to the post titles by promoting them to a h1.
To do that, make use of the is_single and is_page wordpress functions in your header.php and alternate your h1 h2 blog title tags:
<?php if(is_single() OR is_page()) {
// On single post pages and static pages we use this code
?>
<h2><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h2>
<div class="description"><?php bloginfo('description'); ?></div>
<?php }
else {
?>
<h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
<div class="description"><?php bloginfo('description'); ?></div>
<?php } ?>
Now in you single.php and page.php, update your the_title() to h1
<h1 class="single"><a rel="bookmark" href="<?php the_permalink() ?>"></a></h1>
Now because we are using the h2 and h1 tag in the header interchangeably, make sure you style.css caters for both and they look the same
#header h1, #header h2 { font-family: Georgia, "Times New Roman", Times, serif; font-size: 25px; font-weight: normal; padding: 0em 0 0.2em 0; }
do the same for the post title h2 tags in the home page if you need to.