Eric Nagel

Eric Nagel

CTO, PHP Programmer, Affiliate Marketer & IT Consultant

Adding Google’s +1 To Your Thesis Themed Site

I have been, or can be if you click on a link and make a purchase, compensated via a cash payment, gift, or something else of value for writing this post. Regardless, I only recommend products or services I use personally and believe will be good for my readers.

Google announced the availability of +1 today, and gives you the code to add +1 to your website. But if you’re using Thesis, how can you add it to your posts?

Google +1

I have buttons to Tweet my posts, like them on Facebook, and Stumble them, and I wanted to add +1.

Within /wp-content/themes/thesis_18/custom edit custom_functions.php, and add:

function social_sharing() {
	if (is_single()) {
	<table border="0">
			<td><a href="" class="twitter-share-button" data-url="<? echo((get_permalink($post->ID))) ?>" data-text="<? echo((get_the_title($post->ID))) ?>" data-count="horizontal" data-via="YOURUSERNAME">Tweet</a><script type="text/javascript" src=""></script></td>
			<td><iframe src="<? echo(urlencode(get_permalink($post->ID))) ?>&amp;layout=button_count&amp;show_faces=true&amp;width=100&amp;action=like&amp;font=trebuchet+ms&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe></td>
			<td><g:plusone size="medium"></g:plusone></td>
			<td><script src="<? echo(urlencode(get_permalink($post->ID))) ?>"></script></td>
	} // ends if (is_single())
} // ends function social_sharing()

add_action('thesis_hook_before_post', 'social_sharing');

Make sure you change YOURUSERNAME to your Twitter username

Then in Thesis Site Options, the Stat and Tracking Scripts field, add

<script type="text/javascript" src=""></script>

Make sure you Specify The Thumbnail Image When Sharing A Link On Facebook From Your Thesis Site to make Facebook’s Like button work nicely.

  • James Seligman
    Posted June 1, 2011 8:32 pm 0Likes

    Work Perfectly! I was getting tired of the SexyBookmarks plugin

  • Logan Thompson
    Posted July 11, 2011 7:36 pm 0Likes

    Nice, other than you use a table. CSS is your friend Eric.

    • Eric Nagel
      Posted July 12, 2011 7:45 am 0Likes

      Yeah, maybe some day I’ll fix that. I’m a programmer, not a coder. BIG difference.

      • Logan Thompson
        Posted July 12, 2011 3:20 pm 0Likes

        Haha, I know. I’m a coder not a programmer. Huge difference.

  • Trackback: E-Mail A Post WordPress Function
Leave A Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.