d||ell

Adding Google Authorship Into Your WordPress Site

September 11, 2013 · ☕️ 1 min read

Based from Craig Fifield’s article on How-To Add Google Authorship To WordPress Correctly I was able to put a better way (hopefully) of doing the said thing.

The catch here is not to waste your time downloading plugins for you to easily integrate the Google Authorship recently from Google.

Here’s how you do it in as easy as 1, 2, 3…

1.) Open your theme’s functions.php file. If you’re using a child theme, use that one (definitely better).

2.) Add the following code below:

// Google Authorship Integration
if (!function_exists('google_authorship')) {
  function google_authorship()
  {
    if (is_single() || is_page()) {
      echo '<link rel="author" href="YOUR-GOOGLE-PLUS-PROFILE-LINK" />';
    }
  }
}
add_action('wp_head', 'google_authorship');

3.) Replace “YOUR-GOOGLE-PLUS-PROFILE-LINK” with your Google+ profile. Save/Upload it and test using Webmaster Structured Data Testing Tool

Edit: Added safeguard to function and some minor corrections.


Personal blog by Dorell James
I love you and coding!

Let me know your thoughts... 😊

Or, continue reading...