How to add Facebook comments to a blog (WordPress, Blogger, Other)

I have been researching this quite a bit and so I wanted to do a post about it. And it was quite a pain. I wanted to add Facebook comments to a site that didn’t have blog functionality (Big Commerce, I will do another post on this).

The way that Facebook comments work is that if you pull the code off the Facebook developers site, and then you insert it on a page. If you utilize this resource here, then you can only get the code for one URL and it doesn’t allow for dynamic content.

So if you add this to your page to have Facebook comments appear on each post, you get ALL the comments sitewide. They just aggregate and you will have comments on your posts that belong on other posts. So I asked some superfriends how to do this and they suggested PHP. So I researched some PHP code (I am not a developer) and I came across these interesting tidbits.

There are a couple of ways to add Facebook Comments.

Since these articles already exist, I am just going to link to them instead of stealing content:

In WordPress (thanks Orun!)

In Blogger

And here is the code if you want to implement it on a site utilizing Javascript (this works best if you are adding this to an html file I guess). I found the code here.

 <div id="fb-root"></div> <script src="http://connect.facebook.net/en_US/all.js"></script> <script> FB.init({ appId:'YOUR_APP_ID', cookie:true, status:true, xfbml:true }); </script> <div id="fbcomments"></div> <div id="fblike"></div> <div id="fblogin"></div> <script> var elemCommentDiv = document.getElementById("fbcomments"); var elemLikeDiv = document.getElementById("fblike"); var elemLoginDiv = document.getElementById("fblogin"); var markupComments = ''; var markupLike = ''; var markupLogin = ''; markupComments += '<fb:comments href="' + location.href + '" numposts="2" publish_stream="true"></fb:comments>'; markupLike += '<fb:like href="' + location.href + '" show_faces="true" width="450" font="tahoma"></fb:like>'; markupLogin += '<fb:login></fb:login>'; elemCommentDiv.innerHTML = markupComments; elemLikeDiv.innerHTML = markupLike; FB.getLoginStatus(function(response) { if (response.status == 'connected') { elemLoginDiv.innerHTML = ''; } else { elemLoginDiv.innerHTML = markupLogin; } }); } FB.XFBML.parse(elemCommentDiv, elemLikeDiv, elemLoginDiv); </script> 

***UPDATE***

Here is another code that I found that works better. I don’t remember where I got it from. But it is better.

WIth this one you have to add the following to your HTML file somewhere before the </head> tag (and replace “YOUR_APP_ID” with your Facebook app ID):

 <meta property="fb:app_id" content="YOUR_APP_ID"/> 

Then add this code wherever you want the comments to appear:

<script language="javascript" type="text/javascript"> var uri=document.location.href; //get uri var isFbPrm=uri.indexOf('fb_comment'); if (isFbPrm!=-1) { // fb comment url     try {           var prm=uri.split("?"); //get paramaters         var url=prm[0]; //url         var prmItm=prm[1].split("&"); //parameter items         var newPrmlst='';         var newUrl='';         for(var j = 0; j < prmItm.length; j++) //read all param to get rid of fb param            {               var prmId=prmItm[j].split("="); //get param id                  if (prmId[0]!='fb_comment_id'&&prmId[0]!='notif_t'&&prmId[0]!='ref') { //if parameters are not in the list             newPrmlst +=prmId[0]+'='+prmId[1]+'&';               }            }         uri = url+'?'+newPrmlst;        }     catch (err) {        //Handle errors here              }      } document.write("<div id='fb-root'></div><fb:comments href='"+ uri +"'  num_posts='10' width='500'></fb:comments>"); </script> <script src='http://connect.facebook.net/en_US/all.js#xfbml=1'></script>

Unmarketing | ZAPSOCK

I heard this the other day. I’m not sure where.

It might have been Brian Solis. It could have been Social Media Examiner.

I apologize for not getting the citation correct. Credit should go where credit is due.

But I thought about “Unmarketing” for a long time.

I actually came across the UnMarketing Blog.

Basically, Unmarketing is Marketing 2.0.

Or 3.4 or 7.3. I don’t know which version it is. It is the latest version though.

It is all about engaging. It is about listening to your audience.

Previously, marketing was all about sending out a message to every single person on the planet (there were only three television networks then) and hoping that your ad was better than the other guy.

Now, it is about finding that niche. That tribe.

Find them and engage them with content that you know that they will love.

Create content that they will share.

Create content that is worth commenting on.

I don’t care if you have 1,000,000 fans (Likes) on Facebook or 250,000 Followers on Twitter.

If you aren’t engaging your audience, it means absolutely squat.

So I Did It… | ZAPSOCK

I took my own advice.

This may be the first time in a long time.

I thought about it for a long time after I posted my previous post today about utilizing the power of Facebook for good. And I did it.

I started a Facebook group called “When This Group Reaches 1M Members, I Will Donate $1M to Help the Homeless”

Everyone that joins has to donate a dollar. All of that money will be donated to helping the homeless once the group has reached 1,000,000 members.

Stopping World Hunger With Facebook | ZAPSOCK

I see a lot of Pages and Groups on Facebook that are called, “I bet I can find 1,000,000 people who want to stop world hunger” or “I bet I can find 1,000,000 people who disapprove of the health care reform bill.”

I don’t join these groups.

Why? Because I don’t see what these Facebook groups are doing to actually combat these problems besides talking about it.

I join a group and it shows everyone that I want to stop world hunger, but what am I actually doing to get it done?

I think that these types of groups should charge $1 for every person that joins the group.

Can you imagine the power of that?

$1,000,000 raised in a matter of weeks for whatever cause? And all you have to do is have people drop a $1 into PayPal.

The only problem that I see with it are scam artists. How do we sort out the cons from the causes?

What do you think?

I Despise Social Media | ZAPSOCK

It has been awhile since I last posted. I have been pretty busy with a few things. I have a few exciting projects in the works that I am pretty excited about. I have also been doing marketing for Utah Baby Guide and Free Baby Magazine. Both magazines are really great resources for new and expecting parents.

I wanted to talk about something that I have been thinking about for a long time. You may have noticed the title. I don’t actually despise social media, but I do have a love/hate relationship with it. Let me explain.

I did my undergraduate work in Marketing. My graduate studies are in Internet Marketing. I have studied the best of both worlds. Social media has absolutely revolutionized the way that marketing takes place. Advertising dollars are more wisely invested in Facebook ads than in a newspaper. Social Media allows businesses to reach out to micro-niche markets. It’s beautiful. So why the hate?

  • I think that some people may be putting too much focus on Social Media strategy.
  • Also, everyone and anyone with a Twitter account is all of a sudden a Social Media Guru. Just because someone knows how to tweet, does not make them an expert. So watch out for these guys.
  • Social Media is not a cure-all/cover-all strategy for marketing. There are so many more aspects of Marketing AND Internet Marketing that cannot be taken care of with a Facebook page and a blog.

I have a lot of work to do on my end still. I am the biggest student of my own teachings.

Social Media at its Best | ZAPSOCK

I just started using two new applications: TweetDeck and Flock. I love them both. Some of the functionality overlaps, but there are aspects about both that I really like.

Flock:
Blog Composition – You can compose your blog posts within the browser. When you are done, you choose which blog you want to post to. It supports multiple blog clients. I use WordPress and Blogger for my blogs. When you publish you can choose the tags and categories as well as publish it to your Facebook status.

Media Bar – I don’t really use this that much, but it seems pretty cool. It detects any media feeds from any page that you are on.

Favorites – Sync up with Delicious.

Link Sharing – You can share any page that you are in from the Facebook sidebar.

Searching – The search bar shows you real time results from multiple search engines. You can add any search engine from any site such as Facebook.

Mail – See if you have new mail right in the sidebar

RSS - You have a reader right in the sidebar. The browser also detects feeds that are available on pages. (Most browsers do this). You can organize your feeds into categories and folders however you please right there in the sidebar.

There is also a drag ‘n drop web clipboard and a utility to upload photos directly to Facebook, Flickr, Photobucket or other media sharing sites.

TweetDeck
I just barely downloaded TweetDeck and I am impressed. Multiple Twitter accounts, Facebook, Facebook Pages, LinkedIn and MySpace. Notifications pop up as they arrive on the side of your screen. You can post to multiple accounts at the same time, shorten urls automatically, upload photos and more. Check it out.

These are great tools.

Blogged with the Flock Browser