Enter your keyword

How To Add A Facebook Like Button To Your Thesis Blog

How To Add A Facebook Like Button To Your Thesis Blog

As I prepare to write this tutorial, I will have you know that I’m dying a little inside. It kills me to have to acknowledge that, whether I like it or not, people seem to be attached to the idea of Facebook and the ability to comment on it. But whatever. I move with the times. If you are using WordPress, there are a bunch of plugins you can use to incorporate Facebook functions into your blog, but if you want to do this with some element of customization, you can add functions piecemeal through adding custom functions. This tutorial shows you how to add a Facebook Like button to your blog posts without using a plugin.

1. Add code to generate Facebook like button.

First we have to create a function that will generate the like button and tell it to show up after all of the single posts on your blog. Paste the code below into custom_functions.php. Note: if you want the like button to show up elsewhere, all you have to do is change the hook part of the code (change “thesis_hook_after_post” in the code below to “thesis_hook_before_post” for example).

function facebook_like_button() {
if(is_single()): ?>

2. Add a function that will tell Facebook what it needs to know in the header info of your page.

Just adding a like button won't work unless the header of your page is carrying the right data in the right format for Facebook. So we need to add a function that will ensure that this is happening by adding the following code to custom_functions.php:

function facebook_like_meta() {
if(is_single()) { ?>

3. Test it out.

This should be all you need. Test it out on your blog and make sure it's working.

Hey everybody, we've got a new featured blogger ad up and running! Please check out Carrie's ad for The Sweetest in the sidebar ASAP! If you'd like to participate in the ABDPBT Featured Bloggers Program, please email me and I'll put you on the waiting list.

No Comments

Post a Comment

Your email address will not be published.