Thursday, June 23, 2011

postheadericon Adding a Facebook Like Button to your Site

This article explain about How to Adding a Facebook Like Button to your Site. If you’ve ever used social media voting sites like Digg or StumbleUpon, you’ll be familiar with the concept of “voting up” content you find online. The Like Button is Facebook’s voting up mechanism. It’s a social plugin that allows Facebook users to Like specific pieces of content. A link to the content they’ve liked will be posted to the user’s profile and to their friends’ News Feeds.

When a user Likes your content, they share it with their entire friendship network on Facebook. For this reason, the Like Button is a must-have for your website.

To start the process, visit Facebook’s page for the Like Button. There you can read an explanation of how the button works, but most importantly, you can use the supplied widget to generate a customized Like Button for your site.

Similar to the Like Box we added earlier, this comes in both iFrame and XFBML versions. This time, we’re going to install the XFBML version by default.

It’s easy, and means you do not have to enter anything for “URL to Like.” The code will detect the page or post the user is on, and they will automatically Like that page. Users will also be able to leave a comment on the post to their News Feed and profile whenever they Like your content.

  1. Since we’re using XFBML, we do not need to enter a “URL to Like.”
  2. Next, choose between the three layout options available. Keep in mind that the “Show Faces” feature is only available when you choose the standard layout.
  3. Show Faces” will display profile pictures of friends who have Liked the same page beneath the Like Button.
  4. Next, set the “Width” so that the Like Button is not wider than the content it will be displayed within.
  5. Choose whether to display the verb “Like” or “Recommend.” While “Like” is the standard, “Recommend” might be more appropriate in formal contexts where “Like” would seem too colloquial.
  6. Lastly, choose your preferred font and color scheme.
  7. When you’re done, select “Get Code.”

Just as we did with the Like Box, we need to paste the code into our website where we want the Like Button to appear. In my case, it’s at the bottom of all blog posts. In a basic HTML website, simply paste the code where you’d like it to appear. In WordPress, you can access this by editing the code for the PHP file controlling single posts. To find this, look in “Appearance” > “Editor.” Unless you’re a code maestro, make sure to save a copy of the original before making any changes.

In my case, I’ll open the Single Post PHP file and look for php the_content, a tag which serves up the content of your blog post. I’ll paste the Like Button code directly below this to ensure the Like Button is the first thing that appears at the end of a post.

If you’re a developer, make sure to read through Facebook’s Like Button documentation to discover more advanced functionality.

When a user Likes your content, a link to the item is posted under “Recent Activity” on their profile. The anchor text will be taken from the title attribute of the page being shared. Now, anyone who visits the user’s Profile will see a link to your content.

After you’ve added the code to your site, no more work is required to maintain the Like Button. You’ve just installed a fully passive promotional channel for your content on Facebook!

0 comments:

Related Posts Plugin for WordPress, Blogger...

Category

Short Message here


Followers

Powered by Blogger.

About Me

My photo
Learning by googling, reading, and doing

Popular Posts