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);
}
Back to top ^

Join Paulund

  • Get access to 100s of premium tutorials and downloadable content
  • Members content consists of Premium WordPress plugins, CSS packages, jQuery packages, tutorial demo files and templates for 100s of web development tutorials
  • In-depth development tutorials
  • Priority tutorial requests
  • Priority email development support
  • No ads

Here at Paulund you'll find Web Development tutorials and snippets focusing mainly on PHP, WordPress and CSS. Members will get access to premium tutorials that go into more detail about development with these languages. You will also get access to downloadable premium content based on the tutorial.

Join Paulund

Leave a Reply

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