I’ve previously written about rich snippets code for [intlink id=“2948” type=“post”]Mystique 2[/intlink]. There are also [intlink id=“1520” type=“post”]generic instructions[/intlink] and code for the themes [intlink id=“3015” type=“post”]twenty eleven[/intlink], [intlink id=“3017” type=“post”]me gusta[/intlink] and [intlink id=“2468” type=“post”]thesis[/intlink]. Below is updated code for Mystique 3
1. The first problem was with the author information / hrecipe section
The solution:
You need a google profile. Your google profile must be linked from somewhere on the page, with rel=“me”, AND the main domain of your website must be listed on your google profile links.
I achieved this with the Mystique theme with a series of modifications.
Firstly, I added the code from yoast (as shown below) to functions.php
[php]function yoast_add_google_profile( $contactmethods ) {
// Add Google Profiles
$contactmethods[‘google_profile’] = ‘Google Profile URL’;
return $contactmethods;
}
add_filter( ‘user_contactmethods’, ‘yoast_add_google_profile’, 10, 1);[/php]
Second, I went to my wordpress profile page and filled in the google profile field with a link to my google profile
Third, I edited a line to author.php, again, based on information from yoast, but changed for the Mystique theme
[php]
<?php if(($app—>author->get(‘user_url’)) && ($app->author->get(‘user_url’)!== ‘https://’)): ?>
<?php _ae(‘Home page:’); ?>
<?php endif; ?>
[/php]
And add the following
[php]
<?php if(($app—>author->get(‘google_profile’)) && ($app->author->get(‘google_profile’)!== ‘https://’)): ?>
<?php _ae(‘Google Profile:’); ?>
<?php endif; ?>
[/php]
Then I edited AtomObjectAuthor.php and changed line 213 by adding rel=“author” so it reads as follows
[php]
return ‘<a title=“ ‘.$title.’ ” href=“ ‘.$this->getPostsURL().’ ” rel=“author”>’.$this->getName().’</a>’;
[/php]
When this is correctly implemented you should get a success message in the snippets testing tool which reads Verified: Authorship markup is correct for this page
2. The second problem(s) were with the hfeed / hentry section and included the following:
Missing required hCard “author”.
Warning: At least one field must be set for Hcard.
Warning: At least one field must be set for HatomEntry.
Warning: Missing required field “entry-title”.
Warning: Missing required field “updated”.
Warning: Missing required hCard “author”.
The solution(s):
Use the wordpress editor to edit single.php
Find the code
[xhtml]
<h1 class=“title”></h1>
[/xhtml]
replace this with…
[xhtml]
<h1 class=“title entry-title”></h1>
<h2 class=“updated”></h2>
<h2 class=“vcard”></h2>
[/xhtml]
A final note — Don’t just copy and paste the code from this page, as for some reason (I’m guessing character encoding) it wont work. Copy it from here and paste into windows notepad. Then re-copy it from windows notepad (or any other basic plain-text-only editor) and paste into the wordpress editor. Going via notepad loses any hidden encoding or other data which causes a problem so the code is treated as the plain-text it is supposed to be!
Is there an update for this since the code is so much different now using the atom engine?
I have tried to possibly add the code with the atom calls but I am just a little unsure of how to get this to work properly.
Not yet as this code still works. However, I will be doing an update of it all in the near future — once the issues associated with the migration of the site have been resolved 🙂 Check back in 3–4 weeks 🙂