Custom Search

Wednesday, September 19, 2012

How to Add Google Authorship to Your WordPress Thesis Website

In this post I would like to share how I have added google authorship/ profile picture/ avatar next to my sites. And this can be done very easily using your wordpress thesis site. Some of you may think your avatar can only be shown next to your blog posts and this feature is available only to blog articles, but it is not you can show up your picture next to any page you have and it’s gives an advantage to your site over your competitors:

google authorship avatar

So let’s begin.

Now before I go further I want to thank Marco from How to Make My Blogwho put together this tutorial in the first place. I am just improving his method he shared.

Step 1: Sign up for a google plus profile

You should have one by now but if you don’t then go and setup a new profile on google plus.

Step 2: Create a profile

Create a profile, bulk it up with your info and a profile picture. The profile you set on your plus account is the one that will show up on the search results. There is a +1 tab on your profile. Just edit and you will see it, select “Show this tab on your profile” and save. Now you need to +1 at least one page from the web. +1 this article by clicking the +1 button to the left. You are done now for this!

Now you need to put a link to your blog from your google plus profile. Go to “about” section and select “Contributor to” and add your blog address. It doesn’t matters where you link, just make sure it’s a link to your domain.

Save changes!

Step 3: Adding code to your Thesis site

Go to your wordpress dashboard and click thesis > custom file editor.

Now select custom_functions.php and click edit selected.

Now at the very end of the code add these codes:

function change_author_link( $link, $author_id, $author ) {  if ( 'your-wordpress-username-here' == $author )  return 'http://www.yourdomain.com/';  return $link;  }  add_filter( 'author_link', 'change_author_link', 10, 3 );

-In the author part just replace this default text with your username. Yourusername is the same as what you type in to log in. For many users it is “admin”. Also add your own domain there.

And also add this other code:

function custom_headline_catcher() { ob_start(); } function custom_headline_catcher_end() { global $thesis_design; if ($thesis_design->display['byline']['author']['nofollow']) $output = str_replace( 'rel="nofollow"', 'rel="nofollow author"', ob_get_contents() ); else $output = str_replace( 'class="url fn"', 'class="url fn" rel="author"', ob_get_contents() ); ob_end_clean(); echo $output; } add_action( 'thesis_hook_post_box_top', 'custom_headline_catcher' ); add_action( 'thesis_hook_before_post' , 'custom_headline_catcher_end' );

So that everything together will look something like this:

Save the changes.

Step 4: Link to your Google+ profile from your website

Now add a link to your google+ profile. To find this link just open your profile and copy that link.

Now add this code to your footer. If we add this on the footer, all of your pages will show up the picture, since the footer appears on every page!

Tamal Anwar

Type anything you want but make sure your name and url is the same as it appears on the google+ profile. To add it on the footer, add a plugin called “Thesis Open Hook” go to appearance > thesis open hook and then footer hook (way down on the page).

You may try different things like I did on mine, just want that name and link to appear on the footer:

Step 5: Check if everything worked

Go to this page called rich snippets and type in your web url. If you did according to what I wrote, you should see it positive.

Okay so it works. But if it doesn’t, then redo the steps above.

Step 6: Submit your authorship to google

Now all you have to do is to apply for your author picture. Use this google form and click submit. Then wait a few days and you should be able to see your picture next to your google listings!

Have your say

Do let me know what you think and if you had success after using this tutorial. Also +1 this post if you find it helpful.