Thesis and the Facebook Like Plugin

One of the best ways of promoting your blogs is via Facebook integration. There are a number of ways of achieving this, but I’ve found that the most organic and least intrusive way of promoting a single post is the Facebook like button (not unlike posting a link to your Twitter stream). It isn’t associated with a fan page, but simply renders an entry into your Facebook stream that states you like a particular post on a particular website. It’s a great way of sharing content with friends.

Facebook Like text as it will appear on your site

Although there are a stack of WordPress plugins that will accomplish what I’m about to show you, and assuming you’re using Thesis, these plugins won’t take advantage of the framework’s hook framework . If you do go the way of a plugin I suggest you try out the fblikebutton WP plugin. It’s easy to use and most compatable with Thesis.

Facebook makes the process of adding a like button a piece of cake. From their development site, you can simply enter a few details and they’ll give you code that you can post onto an individual page.

What I’m going to do here is show you how to use Thesis hooks to place the Facebook like content anywhere the framework’s hooks permit. When a user clicks the ‘like’ button it will send details of your post and website to the users Facebook page.

Facebook user stream

The most likely spot you will want the like button is after a post (Hook: thesis_hook_after_post).

Like button at the end of a post (hook: thesis_hook_after_post)

Navigate your way to wp-content/themes/thesis/custom and open up custom_functions.php for editing. Add these lines at the end of the page.

There are a number of parameters you can change, most notably the width and height of the Facebook iframe.

Thesis Open Hook

If you’re not overly comfortable using hooks, you can accomplish the same result using the Open Hook plugin.

Select Open Hook from your WordPress menu, browse to the hook After Post option and paste the following code inside of the text box.

Be sure to click the option “Execute PHP on this hook”. Save and exit.

It’ll be interesting to track the popularity of Facebook’s Like button into the future.

Shortt URL for this post:

1 comment

  1. Karen Miles

    Thank you. I tried a few Facebook plugins and when none worked I was going to give up. Google search… internoetics… and my answer. Worked just as promised.

Leave a Reply

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