Skip to content

Instantly share code, notes, and snippets.

@Steven-Rose
Created March 15, 2012 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Steven-Rose/2045328 to your computer and use it in GitHub Desktop.
Save Steven-Rose/2045328 to your computer and use it in GitHub Desktop.
WP: Add Google+ button to your posts automatically (updates todo)
add_filter('the_content', 'wpr_google_plusone');
function wpr_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','wpr_google_plusone_script');
function wpr_google_plusone_script() {
wp_enqueue_script('google-plusone', 'https://apis.google.com/js/plusone.js', array(), null);
}
via http://www.catswhocode.com/blog/super-useful-wordpress-hacks-and-snippets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment