in WordPress

Automatically Add Google+ Button After Post

Google Plus Google+ is the latest social media trend to hit the internet, it is growing in users all the time and it is fast becoming a very engaging community. You will find that because you can share content with a comment with targeted people you will get more interaction with each article you share. This can drive a lot of traffic to your website but you need to get different people sharing your content. In this snippet it allows you add a Google+ button to the bottom of each post on your Wordpress blog. Just add the following snippet to your functions.php page.


add_filter('the_content', 'google_plus');
function google_plus($content) {
    $content = $content.'<g:plusone size="tall" href="'.get_permalink().'"></g:plusone>';
    return $content;
}
add_action ('wp_enqueue_scripts','google_plus_script');
function google_plus_script() {
    wp_enqueue_script('google-plus', 'https://apis.google.com/js/plusone.js', array(), null);
}

Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To The Weekly Newsletter

Get weekly updates to your email