I keep telling folks I’d share how we’re integrating authorship microdata to produce search result rich snippets. It’s working well for our clients in increasing their SERP CTRs) so I figured I’d document it here for WordPress sites.
There are two pieces to this… and the two elements are not related. The authorship data is now being displayed in Search Engine Results Pages. I have not seen publisher info displayed yet… but I’m sure it will be!
Publisher
Google Plus now has a verification system where a publisher of a site can point to their Google+ page. By adding the following code in our theme’s functions.php page, we’ve added a section to our WordPress Administration general settings where we can paste our Google+ Page URL:
function social_settings_api_init() {
add_settings_section('social_setting_section', 'Social Sites on the Web', 'social_setting_section_callback_function', 'general');
add_settings_field('general_setting_googleplus', 'Google Plus Page', 'general_setting_googleplus_callback_function', 'general', 'social_setting_section');
register_setting('general','general_setting_googleplus');
}
add_action('admin_init', 'social_settings_api_init');
function social_setting_section_callback_function() {
echo '<p>This section is where you can save your social sites where readers can find you on the Internet.</p>';
}
function general_setting_googleplus_callback_function() {
echo '<input name="general_setting_googleplus" id="general_setting_googleplus" type="text" value="'. get_option('general_setting_googleplus') .'" />';
}
The next step is to publish the publish link on every page on the site outside of your single blog post pages. So, in our header.php, we add the following code:
<?php if(!is_single()) { ?><link href="<?php echo esc_attr(get_option('general_setting_googleplus')); ?>" rel="publisher" /><?php } ?>
Authorship
Authorship is a little more in-depth, especially if you have a multi-author blog like ours. Basically, we want all of our pages that authors write to display their Google+ profile data in search engine results. To get this down, I had to go to the master himself, Joost de Valk and read up on his rel=”author” post.
The first step is to override WordPress settings and allow anchor tags to be published with the appropriate rel element. Within functions.php, add the following code:
function yoast_allow_rel() {
global $allowedtags;
$allowedtags['a']['rel'] = array ();
}
add_action( 'wp_loaded', 'yoast_allow_rel' );
The next step is to add code to functions.php that adds a field to your User Profile page where the authors can fill out their Google+ URL:
function yoast_add_google_profile( $contactmethods ) {
// Add Google Profiles
$contactmethods['google_plus_profile'] = 'Google Plus Profile URL';
return $contactmethods;
}
add_filter( 'user_contactmethods', 'yoast_add_google_profile', 10, 1);
Now that you’ve got the field in there, you’re going to have to add an author link to every page that will point to your author content, like single.php, index.php, author.php and archive.php. Within those template pages, display the author link along with the rel=”author” and that link should point to your author.php profile page:
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author"><?php get_the_author(); ?></a>
Within your author.php page, you’re going to want to display the profile information along with a rel=”me” link that points back to your Google Profile page:
$google_plus_profile = get_the_author_meta( 'google_plus_profile' );
if ( $google_plus_profile ) { echo '<p><a href="' . $google_plus_profile . '" rel="me"><img src="http://www.google.com/images/icons/ui/gprofile_button-32.png"></a></p>'; }
You tired yet? Don’t be… next step is to actually add a contributor link back to your author page within Google Plus:

Ok… now your author links are pointing to your author page, your author page is pointing to your Google Plus profile, your Google Plus profile is pointing to your author page. Do you see how we’ve got the entire circle covered here? One last step…
Use the rich snippets tool and actually verify that your rich snippets work okay! Test it on your root domain and your single post pages.

And now put in your domain and give it a shot:

Last note… all of this works pretty good, but not all the time. Sometimes I notice the rich snippets tool gives me an error and other times I see where rich snippets test fine, but it takes a few weeks to see them in search results. Either way, it’s a modification worth doing! Keep in mind that, since we did all of this within our theme that a new theme would require us to implement it all over again!