Become Wordpress Professional - Your Ultimate Wordpress Guide

Wednesday, 3 April 2013

How to Add Google Plus Button in Posts

Google is known for its greatness all around the globe. Integration of google plus button in posts can be a great move as it basically works similar to facebook like button, but more of it, if someone hits a google plus button on your blog post, it is considered as a vote of recommendation and google utilizes that vote to assess the particular post in assigning it the google search engine results position. To be more clear and specific, the more google plus likes your post gets, the more letters of recommendation the posts has, the more higher it ranks in search engine results pages.

Now that you know the importance and power of google plus button, you may move on to integrate it in your blog posts.

You Might Also Like: How to add Facebook Like Button in Wordpress

Integrating Google Plus Buttons inside Posts in Wordpress

To integrate google plus button inside posts, first of all you need to open up your theme's functions.php. Now you need to add a filter that will take the posts content, bypass it and add a google plus button before the content is rendered. Copy the code below and paste it into functions.php, you may paste the code at the bottom of the file. Then save settings.

// Using Add Filter Function to integrate google plus button

add_filter('the_content', 'my_google_plusone_button');
function my_google_plusone_button($content) {
// Do not forget to remove the comments from the code below 
// Using the add_action wordpress function to add a goolge script required to generate the google plus one button.

add_action ('wp_enqueue_scripts','wpr_google_plusone_script');
function wpr_google_plusone_script() {
 wp_enqueue_script('google-plusone', 'https://apis.google.com/js/plusone.js', array(), null);
}
That is it, now you will have posts containing a google plus one button, a powerful tool that can help your blog posts rank higher in search engine results page.

1 comment:

  1. yeah well google plus is most needed to survive in internet.. I love this to work on it. Thank you!

    ReplyDelete

Please Avoid Spamming. Comments will be moderated before they are published.