Skip to content

Instantly share code, notes, and snippets.

@anandkumar
Last active December 16, 2015 11:38
Show Gist options
  • Save anandkumar/5428536 to your computer and use it in GitHub Desktop.
Save anandkumar/5428536 to your computer and use it in GitHub Desktop.
Add Google+ comments on Genesis Framework / WordPress (or any website)
/*** Google+ Comment for Genesis Framework ***/
add_action('genesis_before_comments', 'google_plus_comments');
/*** More info at http://www.blogsynthesis.com/?p=1072 ***/
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 }
}
/* Google Plus Comments - Don't forget this will highly depend on your theme
If you have any problem - leave a comment at http://www.blogsynthesis.com/?p=1072
------------------------------------------------------------ */
#google-plus-comments {
padding: 25px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment