I spent a couple hours this afternoon fixing one of my less popular blogs to include proper markup to have the authors linked to their Google profiles. The reason to do this is so that you can have your photo appear in the search results next to the article you wrote.
While I was modifying the code it got me thinking about how many other people might want to do the same thing. So I’m going to add som additional information to the already good overviews out there on how to get your photo to show up in the Google search results.
Follow the directions that Mark lays out in his post, but when you get to step 2 come back here… I’ll wait.
Ok, now you have to add two specific pieces of code to your WordPress blog to make this work. Each one of your articles has to have an author link back to your author page. That is core functionality in WordPress, just make sure it’s turned on – yes, even if it is a single author blog. The catch is that the link needs to have the rel=author attribute added to the link. You can add a link to your author bio but WordPress will strip out the rel attribute. You can attach it in a parameter like this: https://plus.google.com/107187240364808249726?rel=author
Many better themes now include this capability (or soon will), if they don’t you’ll need to create a filter in the functions.php file. A filter is a way of catching output from the database and reformatting it before it hits the page.
Before we get to filters, let’s add some new fields to the author’s section of each user. I don’t know about you but I’m not really a big AIM Yahoo Messenger or Jabber user, so I can get rid of those, but I’d like to include Facebook, Twitter and Google+. Here’s what I added to my functions.php file.
[php]
function my_new_contactmethods( $contactmethods ) {
unset($contactmethods[‘aim’]);
unset($contactmethods[‘jabber’]);
unset($contactmethods[‘yim’]);
// Add Twitter
$contactmethods[‘twitter’] = ‘Twitter profile URL’;
//add Facebook
$contactmethods[‘facebook’] = ‘Facebook profile URL’;
//add Google+
$contactmethods[‘google’] = ‘Google+ profile URL’;
return $contactmethods;
}
add_filter(‘user_contactmethods’,’my_new_contactmethods’,10,1);
[/php]
Great, now you can go update your blog author profile an make sure you include your Google profile url (which should look something like https://plus.google.com/107187240364808249726 (you don’t need anything after the number).
Now let’s build out that filter!
This is for your author archive page, for example, mine is at http://www.1918.com/author/phil-buckley/. The idea here is to link your name to your Google profile using the rel=me attribute. I accomplished it this way:
[php]
/** Customize the author box function */
add_filter( ‘genesis_author_box_title’, ‘author_box_title_filter’ );
function author_box_title_filter($author_box_title) {
if (is_author()) {
$author_box_title_filter = ‘‘. get_the_author() .’‘;
return $author_box_title_filter;
}}
[/php]
You might have noticed that mine is inside a Genesis child theme, but you can do the same thing with almost any theme.
The addition of get_the_author_meta(‘google’) is what pulls in the new author attribute.
Now you have remember to add your website to your Google profile. Make sure that under the About section of your profile you add the url for the site you just set up under the Contributor to section (in the right rail).
Once that’s done you can test your pages to see if all is well using the Rich Snippet Testing Tool. I suggest testing your homepage, a post page and your author archive page.
You can also fill out this form, it might help.
If you need any help, let me know and I’ll try to give you a hand.
Chris Anicich says
Attempting getting a photo of my Doctor client to appear in search results on Google and having a heck of a time and need your help if you are available please email at cra@webdeveloperandseo.com
Thanks Chris
Phil Buckley says
It’s not an automatic thing. You can have everything in place and still not see your authorship photo appear right away. Often you need to wait a bit (between a couple weeks and a couple months) for it to appear.