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);
}

Leave a Reply

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