Optimize your WordPress theme for SEO

One of the things you should care about when starting a WordPress blog is the SEO (Search Engine Optimization).

SEO is what will say to Google, Yahoo how important is your content.

Today we are going to set some XHTML tags in our template code:

1. Index.php (home)

- Use the H1 tag in the blog name / logo.
- Use the H2 tag for the post title.

Something like:

<h2><a href="<?php the_permalink(); ?>" title="< ?php the_title(); ?>">< ?php the_title(); ?></a></h2>

2. Single.php (post page) & Page.php (static page)

Here we must tell the spiders that the post title is the most important part of the page.

- Use the H1 tag for the post title

3. Archive.php (Category, Tags, Years... page)

You can follow the Index.php advices.

After apply this tags you have to pass the W3 Validator. Like this blog does.
It is not necesary to validate every page of your blog (but would be nice). At least do it for the home page and the single post page. A clean output code means better SEO.

Now its your turn. What your advice to Optimize a WordPress theme?

10 comments
  • Good tricks Quicoto, my blog has been indexing better in google when i aplied this parameters.

  • Interesting post.
    will apply these parameters to my new template (under construction) πŸ™‚

    thanks

    ooohhh my first comment in English!! jajaja

  • I’m developing a new theme for Viajar sin Destino and Travelling Lost sites and in Index.php i’m using h1 for the site description instead of for the site title which is almost irrelevant for search engines. This way I can use my site description as something more important than just a quick tip about the site.

    • Well I don’t know how it should be.

      I think it just depends in what you want. And yes, like you said if you want to highlight the description put the H1 right there.

      Thanks for commenting πŸ˜‰

  • Can this be used in bbPress?

    • No, the file structure is diferent from WordPress and bbPress.

      What you can do is modify the h1, h2 and h3 from the front-page, topic and other files.

      I’ll try to make a post about it soon.

      Stay in touch.

      Regards.

Leave a Reply

Add <code> Some Code </code> by using this tags.

*
*