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

Advertise here

Comment