How to implement Google Authorship for multi author wordpress blog

1 Flares 1 Flares ×

In my last post I discussed how to implement Google Authorship for a single author blog or website. Today in this article I will discuss how to implement Google authorship for multi author wordpress blog. Implementation of Google authorship for a single author blog or website is very easy whereas for multi author blog the implementation includes some code changes in your template files. If you are technically sound enough it would be easy for you but if you are not from technical background you can ask any techie person or your friend to do the changes. So lets see step by step implementation of Google Authorship for a multi author wordpress blog.

 

Step By Step Guide To Implement Google Authorship for multi author blog:

 

STEP1: First of all all the authors have to create their Google Profile if they have not created one yet.

 

STEP2: This step involves in modification of some of your template files. Edit “functions.php” file and add the below lines of code at the end.

function jafaloo_allow_rel() {

        global $allowedtags;
        $allowedtags[‘a’][‘rel’] = array ();
    }

 

add_action( ‘wp_loaded’, ‘jafaloo_allow_rel’ );

The above code will allow you to add all “rel” value to be added in a link. rel=”me” and rel=”author” are the required properties for the implementation of Google Authorship.

 

STEP3: Add the below code to the same functions.php file:

function jafaloo_add_google_profile( $contactmethods ) {
        $contactmethods[‘google_profile’] = ‘Google Profile URL’;
        return $contactmethods;
    }

add_filter( ‘user_contactmethods’, ‘jafaloo_add_google_profile’, 10, 1);

The above code will allow your blog’s authors or users to add a Google profile URL to their profile.

 

                    google-profile-url

 

 

STEP4: This step involves in modification of author.php file of your template. Add the below code to the author.php file.

<?php
            $curauth = (get_query_var(‘author_name’)) ? get_user_by(‘slug’, get_query_var(‘author_name’)) : get_userdata(get_query_var(‘author’));
            $google_profile = get_the_author_meta(‘google_profile’,$curauth->ID);
            echo “<b>Follow me on:</b><br>”;
            if ( $google_profile ) {
                echo ‘<a href=”‘ . $google_profile . ‘” rel=”me”>Google Profile+</a>’;
            }

<?>

The above code creates a link to your Google profile in the author archives list. To give it a good look and feel you can customize the code with some CSS and appropriate images.

 

STEP5: In this step you need to modify the “author-template.php” file of wordpress. It is located in the “wp-includes” directory. Open the file and search for the function “the_author_posts_link” and add rel=”author” inside the <a> tag.

<a href=”%1$s” title=”%2$s” rel=”author”>%3$s</a>

This code will confirm that the link to the author profile in the article or post will have the rel=”author” property. You need to make sure that your template is having the author link in the post or article.

 

Now you have made all necessary code changes to be done. It is now time to link the author profile to the Google profile custom links.

 

Which Link should be added to the Google profile?

 

Your blog authors should take care while adding the author’s URL in their Google Profile. Each author should link their own blog profile URL. The URL should be as below:

[your-blog-url]/author/[author-id]/

You should replace [your-blog-url] with the real blog URL and [author-id] should be replaced with the the author’s login user id of your blog.

 

How to test the authorship?

 

To test the authorship of each author you can use the Google’s rich snippets tool. In the URL box enter the URL to any of your article and you can see the authors information.

 

IMPORTANT NOTE: If you are using any caching on your blog then you need to clear all your cache for the authorship to work.

 If you have any problems in implementation please do let me know with your comments.

Guru

+Ayodhyanath Guru holds a B.Tech degree in Electrical Engineering and has worked with various prestigious clients in the IT industry and presently working as a Software Engineer. He is a part time blogger and presently authors the Jafaloo.Com blog. Being a tech enthusiast Guru likes to surf the web and blogs about interesting technical topics like How-To guides, freewares, Tutorials, Software, Gadgets, web applications etc. Apart from blogging he likes coding in Java/J2EE and PHP.

You may also like...

1 Response

  1. Aditya says:

    Thanks a lot for this tut. Helps a lot.

    I just have a question. Whats the point of Step 4?

    Also, where do I add the link on my google profile?

1 Flares Twitter 0 Facebook 0 Google+ 1 LinkedIn 0 1 Flares ×