9

How to Add Google+ comments in WordPress without using any Plugin?

After the introduction of latest Google Search Algorithm “Hummingbird”, it seems that Google is giving more importance to User’s engagement, Social Shares etc rather than backlinks. This is probably the reason why, they are not updating the PR ranks. So many SEO experts also believe that Google is giving priority to Google+ contents. They claims that their traffic increases after sharing their blog posts on Google+. While visiting different blogs of Pro Bloggers, i found that everyone is using Google+ comments in WordPress alongwith WordPress Comments. I also decided to use the same. Firstly, i used Comments Evolved for WordPress Plugin and then i used WordPress Google Plus Comments Plugin but still i was not happy with their performance. I was looking for a simple and user friendly Google+ Comment Box which should appear right above the default WordPress Comments. As you all know, use of more plugins makes a WordPress Blog heavy and Bulky and thus affect its Loading Time. Due to this reason, i decided to use the code instead of Using Plugins. I was trying to write for the code when i came across the code at GITHUB, which was written by Blog Synthesis . I tested this code which worked like a charm. I applied it to this blog and sharing the same for you as well.

How to Add Google+ comments in WordPress without using any Plugin?
  • Login into your WordPress Admin area.You can reach there by entering your credential at http://yourblog.com/wp-admin.The screenshot of the login form is shown below:
WordPress Login Form
  • Facebook
  • Twitter
  • Google+
  • Pinterest

WordPress Login Form

  • Navigate to Appearance>>Editor in your Dashboard. The screenshot of the same is shown below:

  • It will open the Theme Editor Window. Click on “Comment.php” file on the right hand side. The screenshot of the same is shown below:

  • In comment.php file, Try to look for “<div id=”comments”>“. The screenshot of the same is shown below:

  • Paste the Below given codes just below “<div id=”comments”>” in your comment.php file.
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<div id="plusonecomments"></div>
<script type="text/javascript">
  window.setTimeout(function() {
    var id = 'plusonecomments';
    var divWidth = document.getElementById(id).offsetWidth;
    var width = !!divWidth ? Math.min(divWidth, 750) : 600;
    var url = "<?php the_permalink(); ?>";
    var moderationUrl = "";
    var moderationMode = "FILTERED_POSTMOD";
    gapi.comments.render(id, {
        'href': url,
        'first_party_property': 'BLOGGER',
        'legacy_comment_moderation_url': moderationUrl,
        'view_type': moderationMode,
        'width': width
    });
  }, 10);
</script>

 

  • If you are finding it difficult to understand, see the below given screenshot:

  • Once done, click on the “Update File” button. The screenshot for the same is shown below:

  • That’s it. You are done. Google+ comments will be added just above your Default WordPress Comment form so enjoy.
How to add Google+ Comments in Genesis Framework?
  • Copy the below code and paste into your child theme’s functions.php file:
/*** Google+ Comment for Genesis Framework ***/
add_action(‘genesis_before_comments’, ‘google_plus_comments’);
function google_plus_comments() {
if (is_single()) { ?>
<div id=”google-plus-comments”>
<script type=”text/javascript” src=”https://apis.google.com/js/plusone.js”></script>
<div id=”plusonecomments” style=”width: 600px;height: 300px;”></div>
<script type=”text/javascript”>
window.setTimeout(function() {
var id = ‘plusonecomments’;
var divWidth = document.getElementById(id).offsetWidth;
var width = !!divWidth ? Math.min(divWidth, 750) : 600;
var url = “<?php the_permalink(); ?>”;
var moderationUrl = “”;
var moderationMode = “FILTERED_POSTMOD”;
gapi.comments.render(id, {
‘href’: url,
‘first_party_property’: ‘BLOGGER’,
‘legacy_comment_moderation_url’: moderationUrl,
‘view_type’: moderationMode,
‘width’: width
});
}, 10);
</script>
</div>
<?php }
}
  • In style.css file, add the below given Code:
#google-plus-comments {
  padding: 25px;
}
  • That’s it. Now, your blog will show both Google+ comments and Default WordPress comments. Enjoy
Where should i See the DEMO?
There is no need to go anywhere to see the demo of integrated Google+ comments in WordPress. I am using the same on this blog. To check the demo, scroll down the page of Blog Post. You will see Google+ comment box first followed by Default WordPress Comment Box.
Just use the above provided Script and use Google+ comments in wordPress without using any Plugin and that too for free. Isn’t that cool?
From the Editor’s Desk
As i mentioned earlier, Google has recently changed its Search Engine Algorithm and they are giving more priority to the stuffs shared on Google+ . If you are a WordPress user, you must Add Google+ comments to your Blog and try to get more +1 for your Articles.
Share your articles and give +1 to the articles of others. To get better results in Search engines, try to make your contents engaging so that Users can share it on their networks. More shares,likes, tweets, +1 will improve your rankings in SERPs. Don’t give more importance to backlinks.
The above provided tutorial is very simple and easy to understand. However, if you are still finding it difficult to understand or implement, feel free to ask your queries via comments.
Ravi Kumar
 

Hi Guys. I am Ravi Kumar, the owner and Editor of this Blog. I am a Computer Science Engineer and a full time Blogger. I write articles on topics related to Blogging, SEO,Web designing,WordPress,Blogger,Content Marketing,Technology,CPA marketing and much more. However, My main aim is to help other bloggers. You can follow me on Twitter,Facebook and Google+

Click Here to Leave a Comment Below 9 comments

Pin It on Pinterest

Read previous post:
Bugscore Review
Bugscore:A social networking site where you can Score(Rate) everything

While surfing internet, i came across a new social networking site named BugScore which is using an unique concept. It...

Close