How to: SEO your wordpress theme

Status
Not open for further replies.

Apathetic

Active Member
899
2011
241
0
the structure of your theme should also be considered when it comes to SEO. Here are some of my tips:

1. SEO your wordpress Logo. This will make use of <H1> tag when in the index page and the <p> tag if it's not in the index page.

Code:
<?php if (is_home()) { ?>
     <h1><a href="<?php bloginfo('url'); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/logo.png" alt="<?php bloginfo('name'); ?>"></a></h1>
<?php }  else { ?>
     <p><a href="<?php bloginfo('url'); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/logo.png" alt="<?php bloginfo('name'); ?>"></a></p>
<?php } ?>

2. Too much <h1> tags in the index page. If there are h1 tags like this:

Code:
<h1><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a></h1>

replace it with:

Code:
<h2><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a></h2>

3. Don't fill the sidebar with <h2> tags. Instead replace them <h4> tags.

If you're using widgets, Open wp-content/themes/<theme name>/functions.php and find:

Code:
‘before_title’ => ‘<h2 class=”widgettitle”>’,
 ‘after_title’ => ‘</h2>’,

Change it to

Code:
‘before_title’ => ‘<h4 class=”widgettitle”>’,
 ‘after_title’ => ‘</h4>’,


4. Use <h1> tags for single post titles. Edit single.php and replace <h2> tags of the post title to <h1>.

Code:
<h2><?php the_title(); ?></h2>

into

Code:
<h1><?php the_title(); ?></h1>


5. Prevent duplicate titles for paged archives by changing the content of your <title>

Code:
<title><?php wp_title(''); ?><?php if ($paged>1) { echo ' - Page ', $paged;} ?></title>

***After doing some changes, you'll also have to modify your css to match the changes you made.

6. Add rel="nofollow" to outbound links on your homepage and category pages or simply Add rel="nofollow" to all external links :P

7. Validate your theme and check for errors, Visit:
Code:
 http://validator.w3.org/

***I'm offering free HTML validation error fixing, just send me a kind note.
 
Last edited:
16 comments
Thanks for including examples. I'm going to go look over my WP theme now & compare. It definitely helps how you broke it down w/example code.
 
Thats some awesome tutorial giving there mate!!
I like the way you have EXPLAINED what exactly the change.

Rather than just saying, change H1 to H2, and change this to that, but not if you have this blah blah blah..
You have SHOWN us, what it looks like before and after. Which is awesome.

This will definitely help the newbies that aren't to familiar with HTML and CSS coding.
Good job man, and if you have any more tips and tricks, please share. :)
 
hmm, Change the permalink to /%postname%/ This helps the post structure a lot if you're looking for organic traffic.

Get a ping optimzer plugin to auto ping for every new content you add. Don't forget to add your sitemap to google webmaters and set your SML sitemap settings to update the homepage and posts always with 1.0 priority.
 
  • Index.php - Changed top post title to h2.
  • Page.php - Changed post title to h2.
  • Single.php -Changed post title to h2.
  • Archive.php - Changed page header to h2.
  • Sidebar.php - Changed category headings to h3
 
These are the things that my guy who handled my SEO took care of, besides after I converted my sites to Wordpress it didn't make any difference as a plugin then offered me the choice to handle most of On Page SEO things. These tips were great for those who are looking for some SEO in PHP.
 
Never ever modify the WordPress core files (eg. /wp-includes/*), it will get replaced when you decide to upgrade your WP version. Keep all the changes on your active theme only, that widget stuff... you can do it from functions.php
 
Status
Not open for further replies.
Back
Top