Mar 14

Using the Thesis Theme and Yoast's WordPress SEO plugin

I share the view of other WordPress developers who believe that SEO functionality should not be incorporated into a WordPress theme – it should be in a plugin. This promotes modularity and maintainability and avoids vendor lock-in. If you ever want to change the visual appearance of your WordPress site, your site’s SEO will not suffer.

One of the key selling points of the Thesis Theme – one of the best known premium themes for WordPress – was its inbuilt support for SEO. At the time that the Thesis Theme was first released, its inbuilt SEO features may have been equal to or superior to separate SEO plugins, but times have changed. I am not as critical of the Thesis theme’s native SEO capabilities as some other people, but one definitely can do a better job using some of the SEO plugins out there.

One highly-rated SEO plugin is WordPress SEO by Yoast (Joost de Valk).

Unfortunately, if you attempt to activate this plugin whilst using the Thesis Theme, you will have the problem of duplicate meta tags. You see, the Thesis Theme does not have a configuration option to disable its own HTML meta tag generation. As a result, when you access a page, it will contain both Thesis’s SEO meta tags those generated by the WordPress SEO plugin, which is likely to confuse search engines.

We will need to directly edit the Thesis Theme’s core files to add some code to detect if the WordPress SEO plugin is active and disable the Thesis Theme’s native meta tag generation.

Note 1: This advice only applies to version 1 of the Thesis Theme; version 2 was released late last year, but as of this currrent time, the majority of people using the Thesis Theme are still running version 1.

Note 2: make sure you make backups of all files you edit, just in case anything goes wrong

The file in question is lib/classes/head.php, relative to the Thesis Theme root folder or wp-content/themes/thesis_185/lib/classes/head.php from the WordPress root folder.

On Line 12, there is a call to the method meta().

$head->meta();

We will modify this line to only run the method if the WordPress SEO plugin is not detected.

if (!defined('WPSEO_VERSION')) $head->meta();

The constant WPSEO_VERSION is defined by the WordPress SEO plugin. This is a short-cut method for detecting if it’s activated. Although this is not the official WordPress method of checking for the presence of another plugin, it has the lowest overhead at runtime.

Thesis Theme and All-In-One SEO Pack Plugin

The Thesis theme has some native support for another popular WordPress SEO plugin – All In One SEO Pack.

Whilst analysing the Thesis Theme, I discovered the following on line 122 of this lib/classes/head.php

 if (!class_exists('All_in_One_SEO_Pack')) {

In this case, if All In One SEO Pack plugin is enabled, the Thesis Theme will suppress its native generation of the title and description meta tags, BUT Thesis will still generate its own robot meta tags.

If you want to use the All In One SEO Pack plugin and are prepared to accept the above limitation, then you don’t need to do anything.

However, If you want to entirely suppress all of Thesis’s header meta tags, just as we did with the WordPress SEO plugin by Yoast, then make this change to line 12:

if (!class_exists('All_in_One_SEO_Pack')) $head->meta();

Other Consequences of Making This Modification to the Thesis Theme

  • In the post/page editor, Thesis’s meta box “SEO Details and Additional Style” will remain present even after you enable WordPress SEO. The first four settings “Custom Title Tag”, “Meta Description”, “Meta Keywords” and “Robots Meta Tags” can be edited, but they will be ignored by WordPress SEO, in favour of its own settings
  • If you disable the WordPress SEO plugin, the Thesis Theme’s native SEO meta tag functionality will be automatically re-enabled and any meta tag settings you previously had in Thesis’s meta box will be used
  • If you want to migrate your Thesis Theme’s existing SEO meta tags to WordPress SEO (or a number of other WordPress SEO plugins), there is a plugin for that! It’s called SEO Data Transporter
 

Tags: ,

6 Responses to “Modifying the Thesis Theme to Work with WordPress SEO Plugin by Yoast”

  1. Mike Says:

    Your fix worked great. Took care of the double meta tags. I have been looking for a way to use yoast with thesis 1.0 I have thesis 2.0,but have no desire to start using it.

  2. ProjekSkillZon Says:

    Thanks dude. Really help me to keep using wordpress seo by yoast without modified to much coding for thesis theme 🙂

  3. Barbara Feldman Says:

    Thanks for this! You’ve helped me delay the dreaded conversion to Genesis for just a little while longer. 🙂

  4. Peter Says:

    thank you so much for this, I hadn’t even noticed this problem until recently and couldn’t fix it by simply leaving the dashboard fields blank, as other experts advised. Proud to be an aussie again!

  5. Susanna Says:

    I totally agree that meta titles, descriptions, etc shouldn’t be part of the theme. I don’t even think it should be a plugin – it should really part of WP functionality.

    If you make it part of a theme, then you have to go in a rewrite everything if you change your theme.
    If you use a plugin, what if that company decides not to continue developing. The, same problem persists. I should be like it is with Dreamweaver, and part of the functionality. The rest of our SEO (page redirects etc) can be done within the htaccess file.

  6. Goose Says:

    This fix worked! Thanks. Still using 1.8.5 and this helped clean things up. In my header there are a couple of other things I’d like to suppress (I have them turned off in WP SEO but Thesis generates them itself). One is the RSS Feed and the other is the RSD code. I see in the same file you reference where there are references to them but did not want to hose the site by tinkering with them myself. I was able to take out the Thesis canonical reference from the Thesis admin (WP SEO inserts that itself so I didn’t want a duplicate) but if there was a way to suppress these other two items that would be great. Any ideas would be appreciated and thanks again for the great post!

Add Your Comments

css.php