Previously I have introduced a plugin to add Google Plus commenting to your WordPress blog,Now relax and remove that plugin.

Replace the existing code on comments.php file of your current theme with the following code


<script src="https://apis.google.com/js/plusone.js">
</script>

<div class="g-comments"
data-href="<?php the_permalink(); ?>"
data-width="800"
data-first_party_property="BLOGGER"
data-view_type="FILTERED_POSTMOD">
</div>

You can change the width of the comment box by changing the parameter

data-width="800"

Here is a demo in which I have implemented the code on Twenty Eleven theme.Here is the code of comments.php after the modification.


<?php
/**
 * The template for displaying Comments.
 *
 * The area of the page that contains both current comments
 * and the comment form. The actual display of comments is
 * handled by a callback to twentyeleven_comment() which is
 * located in the functions.php file.
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */
?>

<script src="https://apis.google.com/js/plusone.js">
</script>

<div class="g-comments"
data-href="<?php the_permalink(); ?>"
data-width="800"
data-first_party_property="BLOGGER"
data-view_type="FILTERED_POSTMOD">
</div>

Via Reddit

Comments

  1. says

    Hey, I have just implemented this on my blog. I did not remove default wordpress comment system . I have just added a new hook before the comment hook by using simple hooks plugins . I wanted to thank you for the code though. You have saved my day!! A lot of appreciation for this blog
    Munna recently posted…Make Free Call To Bangladesh India & PakistanMy Profile

  2. carlos says

    THE COMENTS ARE NOT BE SHOWN, TRY DO A COMMENT, GO OUT AND COME BACK.
    YOU GUYS DONT TEST BEFORE POSTING THIS SHIT.

  3. says

    Really useful snippet of code, I think its always better using code instead of using plugins to hog the resources. Though my current site most probably will have no use of G+ comments but certainly will come handy if I decide to use it.
    Shiva Chettri recently posted…Say Hello To ThemesCheap!My Profile

Trackbacks

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv badge