• About
  • Contact
  • What People Are Saying

Posts in category WordPress

Integrating Facebook comments with your WordPress site

Feb17th
2012
Leave a Comment Written by Daniel Veazey

Facebook logoOne of the changes I’ve made to my blog is adding the ability to leave comments using a Facebook account. There are a couple of advantages to commenting this way. First, the reader doesn’t have to type in their name and email address in the WordPress comments, so that makes it a little bit easier for the reader and therefore a little more likely that he or she will leave a comment. Second, when the reader leaves a comment, should he or she leave the “Post to Facebook” option checked, it gives your website more publicity because it shows up in their news feed and all their Facebook friends have an opportunity to see it.

Now I’m going to show you how to add this feature to your WordPress site.

First go to developers.facebook.com/apps and click the Create New App button. Give this app a name, and ignore the App Namespace field. I named mine “danielveazey.com comments.” Click the checkbox saying that you agree with their platform policies, then click Continue. Type in the Captcha words to prove you’re not a spambot. Then you’re presented with a bunch of mumbo jumbo about App ID and API keys and whatnot.

Now go to developers.facebook.com/docs/reference/plugins/comments/. You should see this:

Facebook comments dialogPut your website’s URL in the first field (you’ll be changing this later in the code, but don’t worry about that now). Set number of posts to how many comments you want displayed by default (I left mine at 2). Set the width to a number of pixels that fits your theme well. For mine, I made it 773, and that goes all the way across the main content area of my single posts. You can choose the light or dark color scheme, then click Get Code.

Now you’re going to get your hands a little dirty. Leave that code there and open a new tab on your browser. You need to get into two files in your WordPress theme, header.php and comments.php. Make a backup copy of these files before you go mucking about in them. From your WordPress dashboard, go to Appearance → Editor. Over on the right, click on header.php. Copy all the code in the editor window and save it to a file on your computer so you can change it back if you mess up. Do the same for comments.php.

In header.php, look for the <body> tag. Right below that line, paste all the code from the first part of the pop-up code that Facebook gave you. Make sure it’s the HTML5 version (it should be by default). It’s at the top of the pop-up window. Now click Update File at the bottom of the editor. Here is an example of what that part of the file might look like:

<body <?php body_class(); ?>>
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=221223671306596";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

Now open up comments.php and find the line that reads “You can start editing here.” Paste the second piece of code from Facebook right below that line. You should see your website’s URL where it says data-href=”http://blahblahblah.” Where your URL is, you need to replace that with ”<?php the_permalink(); ?>” so the comments will appear correctly.

So the whole line looks like this:

<div class="fb-comments" data-href="<?php the_permalink(); ?>" data-num-posts="2" data-width="773" data-colorscheme="dark"></div>

Click Update File at the bottom of the editor and you’re done. Now the Facebook comments should show up just above where your WordPress comments appear.

If you found this post helpful, please leave a Facebook comment below, or a WordPress comment below that. Or both.

comments, facebook, tutorial, wordpress

Honcho

Sep14th
2011
1 Comment Written by Daniel Veazey

The content of this video is not really important. It’s just a cute dog being playful and cute. What’s important about this video is that it’s hosted here on my own site. It’s not embedded from YouTube or Vimeo or any other video sharing site. It’s all self-contained. I wanted to start hosting my own videos so I wouldn’t have to rely on YouTube. I like YouTube, but what I like more is being self-reliant. Another important thing about this video is that it’s in .webm format for HTML5 video. If you’re using a browser that’s not HTML5 compatible, however, it will fall back to Flash, or give you an option to download the video if you don’t have Flash. And perhaps the most important thing about this video is that because it’s .webm, the technology behind it is free and open source.

Why am I doing this? Well, I saw Arthur Reeder doing it and he made me want to do it, too. That’s one of the great things about the internet. You get the chance to see so much and there are so many opportunities to learn something new. So without further adieu, here is Honcho:

WebM


Videos    html5, video, webm, wordpress

Do You Spend Enough Time Looking at Your Stats?

Sep13th
2011
Leave a Comment Written by Daniel Veazey

Do You Spend Enough Time Looking at Your Stats?.

Why Free Software has failed the desktop | ZDNet UK

Sep13th
2011
1 Comment Written by Daniel Veazey

Why Free Software has failed the desktop | ZDNet UK.

I think that’s a bit premature to say.

Gimp, Linux

5 reasons you may regret using posterous (and why WordPress is better) – John McLear

Sep12th
2011
Leave a Comment Written by Daniel Veazey

5 reasons you may regret using posterous – John McLear.

3 Reasons I’m Proud to Be an Amateur Blogger

Sep10th
2011
Leave a Comment Written by Daniel Veazey

3 Reasons I’m Proud to Be an Amateur Blogger.

This strikes a chord with me.

Activities

Should Automatic Upgrades Be Opt-In?

Sep8th
2011
Leave a Comment Written by Daniel Veazey

WordPress logoShould Automatic Upgrades Be Opt-In?

Interesting conversation going on at wptavern. Personally, I always update whenever I see that one is available. It seems others are not a vigilant as I. To make automatic upgrades an opt-in feature makes sense to me. It makes it seem like more of a choice instead of making it opt-out. Opt-out just seems like the Facebook way of doing things, and that gives me the creeps.

Sheri Bigelow: Top 10 Features You Aren’t Using – But Should Be!

Sep7th
2011
Leave a Comment Written by Daniel Veazey

Easily Find and Fix Vulnerable Instances of TimThumb « Weblog Tools Collection

Sep7th
2011
Leave a Comment Written by Daniel Veazey

Easily Find and Fix Vulnerable Instances of TimThumb « Weblog Tools Collection

Barrel House Marketing Group

Oct22nd
2010
Leave a Comment Written by Daniel Veazey

I set up a WordPress site for my friend’s business. It’s fairly straightforward with just a few static pages and one dynamic page for photo galleries of promotional events that he holds. It was really fun. I made a child theme of the TwentyTen theme and did just a little bit of tweaking in the style sheets. If you want to check it out, it’s at barrelhousemarketing.com.

Activities

Why you should leave a comment

1. I read all the comments.
2. I reply and answer every question.
3. I always click through to see the sites of commentators.
4. Because you can.
5. You become a participant instead of just an observer.

EvoLve theme by Theme4Press  •  Powered by WordPress Daniel Veazey
Things I find interesting