“SNV Facebook Like Button” Plugin

Posted in these categories: plugins

Well, I’ve gone and done it – I wrote my first WordPress plugin.  I’m super stoaked on how easy it was, and I may end up doing some more work in the future.

And, for my first number, I tackled the same problem I did in my last post: the new Facebook “like” button.

The way I had inserted was too complicated, and required editing of the core plugin.

Not anymore.

Introducing the “Facebook Like Button” plugin.

Basically, it does one thing, and one thing well: It lets you insert the new Facebook like button either under the content of your blog post, above your comments and other social plugins (bookmarks, etc) or insert it manually via a function/template tag.

Simply activate the plugin and head over to the options menu to control the various options (color scheme, width, height, etc) of the plugin, then sit back and watch as your friends “like” your content.

When a person likes a post, by the way, it ends up in their Recent Activity Stream.

Download Version 1.6 of the Facebook Like Plugin

And, as always, feedback is much, much appreciated :)

Version 1.6 adds a whole host of options, from height, width, margin, the verbiage, and more.  It makes the process so much easier than just filling in option menus.  Please enjoy!

Changelog:

0.1a – initial release.
0.2a – fixed spacing issue both above and below
1.0: first stable release – added function to add to a template manually (thanks Amber Weinberg!)
1.5 – added the rest of the options FB gives you (minus the button type – I like the faces, and that’s specifically what I designed this plugin to do).
1.6 – for some reason 1.5 couldn’t be downloaded so 1.6 is just a clone to resync the plugin repository.

  • I have installed it on www.unili.com and it works well. thx
  • delete this =]
  • I already read that you're fixing the big space that happens below the button, and I would click "like" on that if I could. :) Now my question is: on the blog where I'm using this, one of the posts says "13 people like this" but it only shows one picture (specifically, mine). Shouldn't all the pictures be showing? Or will it only show pictures of people who are logged in? If so, do I have a choice to show the pictures even when they're not? I think the smiling faces of lots of people who like the post would be better advertising for its popularity than just a number (but if I can't control it, I s'pose that's okay too.)
  • It will only show people who are friends of yours. If 13 people like
    it, and 2 of them are friends, it will only show two faces. That's
    facebook's security at work :)

    mitch
  • Cool. Thanks. :)
  • Ozh
    The code of this plugin sucks. I've just posted a comment on Think Vitamin but I thought it'd be more appropriate here.

    First lines of the plugin:

    //plugin defaults
    add_option ( ‘width’, ‘450′ );
    add_option ( ‘height’, ‘70′ );
    add_option ( ‘font’, ‘arial’ );
    add_option ( ‘verb’, ‘like’ );
    add_option ( ‘padding-vert’, ‘0′ );
    add_option ( ‘padding-horz’, ‘0′ );
    add_option ( ‘color-scheme’, ‘light’ );

    FAIL.

    Not only you should add all the options in *one array* instead of 7 individual records, but what is the point in issuing 7 extra SQL requests on every page request to re-save those values???
  • Thanks for your (albeit non-constructive) comment. I had mentioned
    above that this was my first plugin, and I'm very open to any
    suggestions on how to fix it and make it better seeing as how I know
    it's a little rough around the edges. If you'd like to make any
    suggestions, please do so (that goes for anyone else).
  • henry
    I installed the plug-in but I don't see a Like button anywhere on my site. Is this supposed to be a widget? Short-code? How do you make the button appear?
  • Try updating the settings - sometimes it takes that to kick-start the
    plugin. I'm still working on a fix for it.
  • Thanks for doing this. Is there any way I can have this show up on all my previous posts?
  • IT should show up on all posts instantaneously. If it doesn't show up
    right away, try saving your settings to see if that "triggers" the
    plugin.
  • FashionistaNYC
    How do you get the icon to be at the side of each post instead of below?? How do I remove the icon from the bottom of each page on my Wordpress blog???

    Thanks

    SB
  • Very cool. Thanks. Simple install!
    Does deselecting actually remove the "like?" Seems that one needs to be logged in to FB for it to "like?"
  • Mitch, activated your plugin, but it doesn't work for me. am i supposed to manually edit html? i don't see any other options when i click 'edit'...
  • Thanks for the plugin Mitch! I appreciate the control panel you created. You might want to give users the option to turn the images off as well. "show-faces=true/false"

    Thanks again!
  • Good call - I think that's an addition I need to make.

    Mitch
  • I am wondering if your facebook like button works in regular websites not just blogs. A non-profit I work with is trying to encourage more on-line participation by putting at least one "like" button on our website. Instructions don't work for us. Not sure how easy it will be to get a fix from Facebook. Thanks! Meg
  • You can insert the button directly with facebook's code - there's a site on facebook's network that lets you do all of the customization items I put in but through their site - it generates the iframe code for you.
  • lukerumley
    Dude, your plugin worked like I expected, and saved my from editing my theme. Easy. Thanks!
  • hi! I'm actually using another Facebook "Like" plugin from AJ blog and I'm quite satisfied with it but the problem with his plugin is that the Like also appears in the pages like "Contact" which I don't like. How about this plugin? Will it just appear on my posts?
  • Actually, there is a way to make it show up only on posts - if you edit your
    single.php (and index.php) you can drop in the code that will allow you to
    manually insert the like button (it's a function/template tag). Change the
    Automatic setting in your options menu to Manual and pull the code below
    it... copy that code wherever you want it displayed, and it should drop it
    right in.
  • It does, actually, but that's a great idea for a feature (hide on pages).
    Thanks for the comment - i'll see what I can do!

    Mitch
  • I've got the plugin finished, I've even added an option in the admin menu to insert it manually or automatically. Where do you want me to send it to?
  • Someone just jacked your plugin. I got a notice that there was an "upgrade" for it, and when I upgraded, it became a completely different version from a guy named Ahmed....and the author goes to his site.
  • Nah, that was my fault. Before it went into the repository i had it named
    something different. Now, I had to rename it "SNV Facebook Like Button".
    Delete the old one and install the new one through the plugin installer :)
blog comments powered by Disqus