In response to a query by Darko Kovancives on my previous article about[intlink id=“1520” type=“post”]fixing Rich Snippets code for the Mystique theme[/intlink] we have resolved the same issues with the Thesis theme. Details of the changes required are below.
Before the file edits you need to carry out various other changes and tasks
- Get a google profile (i.e. a google+ account)
- Add the address of your site (e.g. https://diymediahome.org) to your google+ profile, as a public link
- Get your google plus ID and use it in place of mine in file edit number 5 below
- Change a Thesis setting for showing author on teasers in the options — Thesis: Design Options: Teasers: Teaser Display Options: Tick “author name”
- Change a Thesis setting for linking author in options — Thesis: Design Options: Display Options: Bylines: “Link author names to archives”
Now do the file edits as follows
1. Edit line 151 in content.php to nest the fn span inside a vcard span
from
[php htmlscript=“1”]echo __(‘by’, ‘thesis’) . ” <span class=\“author vcard$fn\”>$author</span>”;[/php]
to
[php htmlscript=“1”]echo __(‘by’, ‘thesis’) . ” <span class=\“vcard\”><span class=\“author $fn\”>$author</span></span>”;[/php]
2. Edit line 114 in content.php to provide updated date as well as published date
from
[php htmlscript=“1”]if ($date)
echo ‘<abbr class=“published” title=“ ‘ . get_the_time(‘Y‑m-d’) . ’ ”>’ . get_the_time(get_option(‘date_format’)) . ‘</abbr>’;[/php]
to
[php htmlscript=“1”]if ($date){
if(get_the_date()!=get_the_modified_date()){
echo ‘<abbr class=“published” title=“ ‘ . get_the_time(‘Y‑m-d’) . ’ ”>’ . get_the_time(get_option(‘date_format’)) . ‘</abbr>. Updated <abbr class=“updated” title=“ ‘ . get_the_modified_time(‘Y‑m-d’) . ’ ”>’ . get_the_modified_time(get_option(‘date_format’)) . ‘</abbr>’;
}
else{
echo ‘<abbr class=“published updated” title=“ ‘ . get_the_time(‘Y‑m-d’) . ’ ”>’ . get_the_time(get_option(‘date_format’)) . ‘</abbr>’;
}
}[/php]
3. Edit line 81 in teasers.php to include updated date
from
[php htmlscript=“1”]echo ‘<abbr class=“teaser_date published” title=“ ‘ . get_the_time(‘Y‑m-d’) . ’ ”>’ . get_the_time($use_format) . “</abbr>\n”;[/php]
to
[php htmlscript=“1”]if(get_the_date()!=get_the_modified_date()) echo ‘<abbr class=“teaser_date published” title=“ ‘ . get_the_time(‘Y‑m-d’) . ’ ”>’ . get_the_time($use_format) . ‘</abbr><abbr class=“teaser_date updated” title=“ ‘ . get_the_modified_time(‘Y‑m-d’) . ’ ”><span class=“value-title” title=“ ‘.get_the_modified_time($use_format).’ ”></span></abbr>’.”\n”;
else echo ‘<abbr class=“teaser_date published updated” title=“ ‘ . get_the_time(‘Y‑m-d’) . ’ ”>’ . get_the_time($use_format) . “</abbr>\n”;[/php]
4. Edit the author href code on line 144 of content.php to add rel=“me”
from
[php htmlscript=“1”]$author = ‘<a href=“ ‘ . get_author_posts_url(get_the_author_ID()) . ’ ” class=“url fn“ ‘ . $nofollow .’>’ . get_the_author() . ‘</a>’;[/php]
to
[php htmlscript=“1”]$author = ‘<a rel=“me” href=“ ‘ . get_author_posts_url(get_the_author_ID()) . ’ ” class=“url fn“ ‘ . $nofollow .’>’ . get_the_author() . ‘</a>’;[/php]
5. Edit line 308 in content.php to insert google account link
from
[php htmlscript=“1”]$output .= “$tab\t<h1>” . apply_filters(‘thesis_archive_intro_headline’, get_author_name($wp_query->query_vars[‘author’])) . “</h1>\n”; #wp[/php]
to
[php htmlscript=“1”]$output .= “$tab\t<h1><a rel=\“me\” href=\“https://plus.google.com/104657888470728381512/\”>” . apply_filters(‘thesis_archive_intro_headline’, get_author_name($wp_query->query_vars[‘author’])) . “</a></h1>\n”; #wp[/php]
very helpful website. it is big useful for us. thanks for sharing.
Have you had any experience doing this with The Genesis themes?
Hey Jon
i’ve the same error for my page http://www.bijouxOr.org
Avertissement : Missing required field “entry-title”.
Avertissement : Missing required field “updated”.
Avertissement : Missing required hCard “author”.
What theme are you using? Try this again after the weekend when I’ve fixed it! 🙂
This part is produces an error. Is the syntax corrupt
https://plus.google.com/104657888470728381512/\”>”
Yes — I’ve had some syntax corrupted by the wordpress code editor and by a plugin. I’ve hopefully resolved this now and will be double checking the code on all posts over the weekend. Sorry about that!
Worked for me like charm! Thanks
Great Tutor…usefull for me,…worked on my blog. Thank You Very Much.
Thanks Jon. Brilliant fix. The Thesis’ hcard errors cleaned up nicely.
We are having a related issue which maybe you’ll know the answer for. We have a some coding generating the hrecipe formatting and can see the markups when inspecting the post elements, but the rich snippet tool isn’t picking it up at all. The developer has no problems getting picked up on her site and others she has built out, but for some reason it isn’t getting picked up on a Thesis theme.
Don’t know if this is in your roundhouse, but if you could take a look that would be awesome.
Here is a post of ours with the markup: Roasted Strawberry Muffin
Here is one of hers with the markup: Applesauce Muffins
Thanks again for the previous fix and for any help you can offer.
I figured out the answer. The recipe was wrapped in a blockquote tag. I changed that to a div tag and everything ran through perfect.
Thanks again on the previous hcard coding.
T
Hi Jon,
Thanks a lot for the excellent post. I do have a little tiny problem. Could you please have a look?
https://www.google.com/webmasters/tools/richsnippets?view=&url=www.wouterdejong.net%2Fblog
Most likely it’s a small thing, but i’m not able to find the problem.
Much appreciated!
I think you’ve mixed up your rel=“me” and rel=“author” tags a bit
You should only have a single rel=“me” link — from your author page to your google profile. everywhere else you should have rel=“author” tags. On your homepage each post has a “by Wouter de Jong” link which points (correctly) to your author page ), but you have rel=“me” on these links. It should be rel=“author”
Once you change these rel=“me” links into rel=“author” I think it will all work — as it stands you’ve got multiple rel=“me” links on your author page, most of them back to itself and only 1 (correctly) pointing to your google profile. I think this is confusing the snippet tool
Hi Jon, it worked perfectly — I didn’t include items 4 and 5 from your list as they are not essential to validate the rich snippet and I’m not betting on Google+ just yet so I don’t want to “litter” my themes 🙂
Thanks for the tip 🙂
Excellent, cheers for the feedback
Ok i will try it again lets see what happen 🙂
having trouble @ Jon Scaife i’m not getting exactly the same code into content.php file. I’m using thesis 1.8.2. waiting 4 your response.…
You might have to search for similar code on slightly different line numbers. If you send me your content.php I’ll have a look
i did this exactly. after doing this my Authorship markup got verified but unfortunately I’m getting below errors .
Warning: Missing required field “updated”.
Warning: At least one field must be set for Hcard.
Warning: Missing required field “name (fn)”.
do i have to wait for few days for crawling?
What’s your site address? Which page are you getting the errors on? The homepage, a post or both? Have you made any other modifications to the theme — like adding extra files or using a child theme?
Sorry — my fault. I’ve figured it out. The code had got mangled by wordpress. I think when I update the post wordpress processes some of the code and takes some of the classes out which makes it disfunctional. I’ve corrected it. Please give it a try now.
Thanks, very useful info. But, how to add meta tags information like this blog? It looks if i do right click in browser » view page info. There are many information on general tab. Like Author, Viewport Etc. My blog is just contain : content, robots, descriptions, keywords in page info..How to get this snippet?
Thank You..
Most of that comes from using a semantic HTML5 theme for wordpress combined with the Yoast SEO plugin. I also have various meta files like humans.txt and robots.txt. Have a look at the wordpress guide for loads of information about improving your wordpress setup.