Fix for Google hatom-entry error

02 May

hatom-entry fix
If you use WordPress are you having problems with the hatom-entry error warnings generated by Google’s rich snippet tool?

hatom-entry fix

After all else failed I found a post by Drake of Drafie’s Designs with the following fix – add the code below to your theme’s functions.php file:

//add hatom data
function add_suf_hatom_data($content) {
$t = get_the_modified_time(‘F jS, Y’);
$author = get_the_author();
$title = get_the_title();
if (is_home() || is_singular() || is_archive() ) {
$content .= ‘<div class=”hatom-extra” style=”display:none;visibility:hidden;”><span class=”entry-title”>’.$title.’</span> was last modified: <span class=”updated”> ‘.$t.’</span> by <span class=”author vcard”><span class=”fn”>’.$author.’</span></span></div>’;
}
return $content;
}
add_filter(‘the_content’, ‘add_suf_hatom_data’);

Drake intended this fix for the Suffusion Theme but it worked well for me over several themes.