Skip to content

Instantly share code, notes, and snippets.

@Tsunamijaan
Created January 5, 2019 08:55
Show Gist options
  • Select an option

  • Save Tsunamijaan/715dfe9631e5f42197d3389cc7533f8a to your computer and use it in GitHub Desktop.

Select an option

Save Tsunamijaan/715dfe9631e5f42197d3389cc7533f8a to your computer and use it in GitHub Desktop.
Automatically add the Google +1 button
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