Skip to content

Instantly share code, notes, and snippets.

@CodeNegar
Created July 18, 2012 03:58
Show Gist options
  • Save CodeNegar/3134079 to your computer and use it in GitHub Desktop.
Save CodeNegar/3134079 to your computer and use it in GitHub Desktop.
html: javascript google plus one button
<!-- Place this tag in your head or just before your close body tag -->
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<!-- Place this tag where you want the +1 button to render -->
<g:plusone></g:plusone>
or:
add_filter('the_content', 'google_plusone');
function google_plusone($content) {
$content = $content.'<div class="plusone"><g:plusone size="tall" href="'.get_permalink().'"></g:plusone></div>';
return $content;
}
add_action ('wp_enqueue_scripts','google_plusone_script');
function google_plusone_script() {
wp_enqueue_script('google-plusone', 'https://apis.google.com/js/plusone.js', array(), null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment