9Wordpress LogoRich Snippets code for the Twenty Eleven theme

I’ve pre­vi­ously detailed the code for enabling rich snip­pets in vari­ous word­press themes (Mys­tique 2, Mys­tique 3, Thes­is & Me Gusta) as well as some gen­er­ic instruc­tions. Below is a set of edits to enable rich snip­pets in the built-in word­press twenty elev­en theme.

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

to

2. Edit content-page.php, line 14

add the fol­low­ing 2 lines

3. Make sure your author inform­a­tion page has a link to your google+ pro­file
Edit functions.php, at the bot­tom add

then go to your word­press pro­file page (dash­board: Users: your pro­file) and fill in the google pro­file URL sec­tion

4. Edit author.php to link to google pro­file, 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

gravatarSam

Im work­ing on a stat­ic web­site and i really did­nt want to show updated by admin on my webpages. is there any way i can hide that but remove snip­pets error too…
i know u said its not recom­men­ded meth­od but do u know how can i do that.… ????
thanks

Reply
gravatarAlex

я бы тебе памятник поставил, спасибо

Reply
gravatarsdpate956

Hi, thanks for the code but it did not cure twenty-elev­en.

There is an incon­gru­ity in the first code sub­sti­tu­tion — the lines are identic­al
1. Edit functions.php, line 581 edit the first line of the func­tion twentyeleven_posted_on()
change

1

to

1

I am still get­ting 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
gravatarJon Scaife

Sorry — when I updated the post a while back I didn’t notice that the word­press visu­al edit­or had removed all the class=”” code! It should now be fixed…

Update: I’ve totally rejigged how code is imple­men­ted and dis­played. Hope­fully this will pre­vent any future recur­rence, and along the way I think the func­tion­al­ity and present­a­tion 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 pen­al­ise your rank­ing if you try to imple­ment snip­pets which tag up hid­den con­tent — their view (rightly IMHO) is that if you think a search engine should see that inform­a­tion, then it’s use­ful inform­a­tion, and there­fore your vis­it­ors should see it too! You can eas­ily apply CSS to style it and repos­i­tion it if you wish.

Reply