9Wordpress LogoRich Snippets code for the Twenty Eleven theme

I’ve previously detailed the code for enabling rich snippets in various wordpress themes (Mystique 2, Mystique 3, Thesis & Me Gusta) as well as some generic instructions. Below is a set of edits to enable rich snippets in the built-in wordpress twenty eleven theme.

1. Edit functions.php, line 584, edit the first line of the function twentyeleven_posted_on() and change

to

2. Edit content-page.php, line 14

add the following 2 lines

3. Make sure your author information page has a link to your google+ profile
Edit functions.php, at the bottom add

then go to your wordpress profile page (dashboard: Users: your profile) and fill in the google profile URL section

4. Edit author.php to link to google profile, edit line 28 (between >header> and </header>) and replace

with

What do you think? Drop us a comment below! If you would like to subscribe please use the subscribe link on the menu at the top right. You can also share this with your friends by using the social links below. Cheers.

Leave a Reply

9 Comments

gravatar Sam

Im working on a static website and i really didnt want to show updated by admin on my webpages. is there any way i can hide that but remove snippets error too…
i know u said its not recommended method but do u know how can i do that…. ????
thanks

Reply
gravatar sdpate956

Hi, thanks for the code but it did not cure twenty-eleven.

There is an incongruity in the first code substitution – the lines are identical
1. Edit functions.php, line 581 edit the first line of the func­tion twentyeleven_posted_on()
change

1

to

1

I am still getting the “update” field error and now it prints the author name at the top of pages and the update date on the top of posts.

Reply
gravatar Jon Scaife

Sorry – when I updated the post a while back I didn’t notice that the wordpress visual editor had removed all the class=”” code! It should now be fixed…

Update: I’ve totally rejigged how code is implemented and displayed. Hopefully this will prevent any future recurrence, and along the way I think the functionality and presentation has been improved too. Let me know what you think. 🙂

Yes – it will show the author name and the updated date on posts – this is required. Google will penalise your ranking if you try to implement snippets which tag up hidden content – their view (rightly IMHO) is that if you think a search engine should see that information, then it’s useful information, and therefore your visitors should see it too! You can easily apply CSS to style it and reposition it if you wish.

Reply