How To Add Rich Snippets for Reviews To Your WordPress Blog

Ads by Google

review snippetsI wrote a few weeks ago about how Google was changing search results dramatically by including more and more semantic information – or what Google likes to refer to as Rich Snippets.

Most recently, this was in the form of recipe meta-data, such as ingredients or cooking time. If you’re running a WordPress blog based around reviews of anything then adding semantic markup is easy.

However, you may find your chosen blog theme is throwing a few errors, so let’s take a look at a suitable plugin and how to deal with some of the errors you might see.

GD StarRatings:

If you do any kind of reviews on your blog, GDStarRatings is an absolute must-have plugin, and I’ve been using it right from the start on my iPad Board Games site to allow readers to rate games they’ve played.

wordpressreview snippets

This plugin has been around along time and the developers were thoughtful enough to include Rich Snippet markup since last year. Unlike the new Recipe micro-format, the markup and rules for reviews has long been established, so the plugin itself produces well formatted review code without any Google validation errors.

Let’s take a quick look at installing and getting the plugin set up, as it can be a little daunting with all the options available to you.¬†First, let’s download it from within the WordPress interface.

wordpress rich snippet review

Ads by Google

After activation, by default the plugin adds a rating block, a thumbs-up bloc, and comment ratings.

rich snippet review

Let’s disable some of those that we don’t need. Expand the new ratings section on your admin sidebar, and click on Settings. Start by disabling the “thumbs-up” ratings by clicking on the green thumbs-up icon next to the word article (check out the screenshot). Deselect all the options for Auto-insert ratings code, and that should remove them.

rich snippet review

I went ahead and did the same for all other auto-inserted ratings blocks except for the main article star rating which is the only one I want.

Testing With Google Rich Snippets Testing Tool:

Head over to the Google rich snippets testing tool here, and enter the URL of one of your reviews.

how to add blog snippets to a website

After running through the testing tool, you may find some more errors as I did, but these will be related to your individual theme rather than the ratings plugin. For instance, on my theme I found that even such simple semantic information such as “entry-title” wasn’t being added. To fix these, you will need to know a little HTML.

Warning: Missing required field “entry-title”.

Warning: Missing required field “updated”.

Warning: Missing required hCard “author”.

Open up the theme folder of your blog, located at wp-content/themes/(name of theme) if you’re going through FTP, or from the WordPress admin screen, expand the Appearance sidebar item and go to Editor.

Open up single.php in your favorite text editor, or just click on the single.php to the left of the editor screen from within WordPress.

First up, Google told us we were missing an entry-title. Hit Find in your browser or editor and look for the_title(). Your can see it’s surrounded by an H2 tag, and in my case with the class=”post_title” applied to it.

how to add blog snippets to a website

We want to add the entry-title class to it too, so in my case I simply added that into the class definition of the H2:

how to add blog snippets to a website

Just below that, Google tells us we are also missing something about when the post was updated. I already have a class=”date” definition, so I simply add “updated” into that one too:

how to add blog snippets to a website

Finally, I’m missing the author information. For now I’ll add it just after the published date. If you already have some code for the_author() somewhere, just surround it with the same span tags as I’ve added below. This tells Google who the author is, their name, and encloses the whole thing in a vcard.

Now, checking the page again I see all the errors have been fixed.

review snippets

As a final step, I’m going to submit my site for Google to start drawing rich snippets from – it won’t necessarily happen automatically, so you need to fill out the form here and Google will consider you for inclusion.

Recipes in WordPress?

There are also a few plugins for adding recipe microformats, however at the time of writing Google had updated their microformat style and neither plugin produced valid results. If you are publishing recipes on your blog, I’d suggest you keep an eye on both hRecipe and RecipeSEO plugins, which I’m sure will be updated soon to reflect the recent format changes.

Conclusion and further reading:

Adding reviews or recipes Rich Snippet data is easy with GDStarRatings, but if your theme isn’t already compatible for the additional author and post meta-data needed, then you may find Google is unwilling to list your site. If you’re getting the same errors as I did, then follow the code tutorial carefully and be sure to make a backup the file in case you make a typo. Next week I’ll begin a series of articles looking in depth at creating a wordpress theme and the structure of themes so you can edit your own a little more, but for now if you’re still getting Rich Snippet errors then feel free to ask a question on the Q&A forum, or post in the comments below, and I’ll do my best to fix them for you.

Ads by Google

10 Comments - Write a Comment

Reply

Nick

Thanks for this amazing article! I had always been wonderings about getting stars in my wordpress articles. I tried gdstarratings, but ditched it due to the learning curve on perfecting it. I’m curious… How do you display the star ratings in the excerpts on your blog homepage?

Anyways, I’d love to see more articles like this. Maybe a wordpress plugin/theme weekly roundup, similar to your cool websites and 10 free albums weekly articles.

Reply

Nick

Thanks for this amazing article! I had always been wonderings about getting stars in my wordpress articles. I tried gdstarratings, but ditched it due to the learning curve on perfecting it. I’m curious… How do you display the star ratings in the excerpts on your blog homepage?

Anyways, I’d love to see more articles like this. Maybe a wordpress plugin/theme weekly roundup, similar to your cool websites and 10 free albums weekly articles.

James Bruce

Apologies for the incredibly late reply, got lost in my inbox mountain.

To display ratings in the excerpt, you’ll need to use GD-StarRating “builder” to make a custom bit of PHP code for article-> star ratings. Then open your index.php (or archives.php, depending on where you want this to display), and insert the snippet you got from builder just after (or similar).

Hope you get on ok, it’s difficult without knowing your exact theme.

As for a regular column – done! I’ll start on one today! May be monthly though~

Reply

Arjun Bajaj

hey, you could also use polldaddy, an automattic product for this. their wordpress plugin has the rating feature too. i dont know about how it acts with google, but it displays 5 star ratings or up and down ratings on every post and comment and page. you can control on where to show it.

James Bruce

Have considered these, but ultimately the content is not stored on your site. Instead, you get an embed code. If polldaddy ever goes down, or stops working, everythign is lost. So I’d pretty advise against any hosted solutions such as that.

Reply

Jon

The better question is how the heck do you get Google to care enough about your site for them to start using your snippets?

Google seems to only be using these in SERPs for HIGH traffic sites. The rest of us are only wasting our time putting them in.

James Bruce

I dont think that’s entirely true, Jon. If you have quality content, and Google decides you are worthy of being included as rich snippets, it will include you. It’s about the quality of content, not size of site or traffic it currently recieves. Eventually, Google will roll-out these changes to be automatic to any site that includes them, at which point anyone with them will most definitely be at an advantage.

Reply

Kathy

Do you know how to make these changes in the WP Thesis Theme, which uses hooks instead of a single.php file? Specifically, I’m looking to fix the “updated” missing required field error. Thanks!

James Bruce

Sorry Kathy, Thesis is a paid template which I dont use myself, but I did find something which might help here:

http://diythemes.com/thesis/rtfm/custom-teaser-byline/

That allows you to specify a custom “by author on xxxx day” teaser line as follows:

function my_teaser_byline() {
global $thesis_design;
$date_formats = thesis_get_date_formats();
$use_format = ($thesis_design->teasers[‘date’][‘format’] == ‘custom’) ? $thesis_design->teasers[‘date’][‘custom’] : $date_formats[$thesis_design->teasers[‘date’][‘format’]];
echo ”;
thesis_author();
echo ”;
echo “n”;
echo ‘on ‘ . get_the_time($use_format) . ‘‘ . “n”;
$categories = get_the_category();
echo ‘cat_ID) . ‘”>in ‘ . $categories[0]->cat_name . ‘‘ . “n”;
}

add_action(‘thesis_hook_after_teaser_headline’, ‘my_teaser_byline’);

If you change this line:

echo ‘on ‘ . get_the_time($use_format) . ‘‘ . “n”;

to

echo ‘on ‘ . get_the_time($use_format) . ‘‘ . “n”;

I think it should work ;)

Reply

Neil

¬†This is an awesome article¬†@muo_jamesbruce:disqus¬†thank you for sharing this excellent information and making it really easy to understand. ¬†Trying to work this out from Google’s official site is a nightmare!¬†

Your comment