“SNV Facebook Like Button” Plugin

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.

Categories: plugins

Adding a Facebook “Like” Button to WordPress – the (Somewhat) Easy Way

UPDATE: I managed to write this into a plugin – Facebook Like Button

Since Facebook announced a few days ago that you would be able to use its OpenGraph technology to “like” pretty much anything on the Internet, I took it upon myself to test out a few solutions for adding a “Like” button on the site.

It turned out to be fairly easy, but not as easy as just adding a plugin and doing forth (at least, it’s not yet, anyway).

Our Plan of Action:

  1. Download and Install the plugin
  2. Editing the core file to allow for correct width and color scheme

Step 1: Downoading the Plugin

I looked through quite a bit of plugins to find this one, and I had to get it from his website because it’s an alpha release, but the Facebook Like Widget does it cleanly and with little fuss.

Step 2: Customizing the Plugin

OK.  Editors note: normally I do not advocate editing the core of a plugin.  Why? Because when you update (and you should!) it will over-write what you did.  However, since this is an alpha release, and I’m almost positive the next changes will allow you easily do these changes, I think once or twice is ok.

You’re going to want to click into Plugins > Editor, and choose the “Facebook Like Widget” plugin from the list.

There’s literally about 20 lines of code:

<?php
/*
Plugin Name: Facebook Like Widget
Plugin URI:
http://allanjosephbatac.com
Description: Add a Facebook ‘Like’ Button Widget to your post pages. Increase visitors!
Author: AJ Batac
Version: 0.1
Author URI:
http://allanjosephbatac.com
*/

function add_facebook_like($the_iframe = ”)
{
    $the_perma    = rawurlencode(get_permalink());
    $the_iframe    .= ‘<div id=”facebook_like”><iframe src=”
http://www.facebook.com/plugins/like.php?href=’.$the_perma.’&amp;layout=standard&amp;show-faces=true&amp;width=600&amp;action=like&amp;font=arial&amp;colorscheme=dark” scrolling=”no” frameborder=”0″ allowTransparency=”true” style=”border:none; overflow:hidden; width:600px; height:auto;”></iframe></div>’;
    return $the_iframe;
}

add_action(‘the_content’, ‘add_facebook_like’);
?>

The bold, color coded areas above show the areas you can change. The width corresponds to how wide your blog is.  if you don’t know, then just leave it at the default (450px) and you should be OK.  However, your friend’s “faces” won’t go to the edge of your content.  In yellow is the “color scheme”.  If you have a light background, choose “light”.  If you have a darker background, like my site, choose “dark”. 

That’s it – the like badge will show up at the bottom:

image

And will also show up on your friend’s “Recent Activity” stream:

Capture

Keep in mind, this is not the most elegant solution, but until others come, this is a great way to get it on your site quickly and with very little editing.

Categories: Tutorial, WordPress

The Uncanny Valley: Applying Robotics Principles to your Interface/Web Design

This post is based on another article I stumbled upon from two years ago:

http://www.codinghorror.com/blog/2008/12/avoiding-the-uncanny-valley-of-user-interface.html

And it got  me thinking: back in 2008 the era of “cloud computing” and even “web desktop apps” (applications that simulate desktop applications, but are hosted online) have come a long way since then.  Google Apps is replacing Microsoft Office, we opt for cloud storage above external hard drives, and even our real life relationships are supplemented by contacts we make online.

As all of these changes take place, I wonder what this is doing to our perception of desktop apps.  Do we look at a web application meant to replace a desktop one and go “Wow, that’s fantastic”

…or do we cringe at the “cannot’s” and “won’t dos”.

There’s a principle in Robotics called the Uncanny Valley.  It states that the more lifelike a robot looks, acts, or seems, the more we pick out the unpolished, un-human bits, and focus on those.  If a robot seems toy-like, cheesy, or metallic, we are quick to write off the flaws.  However, get a robot that can’t be identified between a human, and we start to worry and show emotion.

Web designs are the same.  Not just between web applications and desktop applications, but between two web applications, we compare and contrast the perfections with the blemishes. 

The hard part about this is, it’s all based on perfection.  Your system of choice will always trump and be the mold for which all other applications are measured.

Take GMail, for example:

gmail

Anyone who uses Gmail may consider this the i-ching of simplistic design.  It’s well thought out, simple to use, and everything’s well labeled.

Look at a Live.com email account, on the other hand…

live

And you might say that everything is fairly similar… except for the huge ad on the right side! omg omg!!!1

OK you may not say it exactly like that, but considering that’s really one of the only differences between the two sites, you will zone in on that one giant change and maybe nothing else.  (FYI, I actually like Live’s color scheme and layout better, but use Google Apps because of the integration).

So you see, we’ve entered a spot in the design spectrum where the Uncanny Valley affects us all. However, it gets harder and harder to please everyone design-wise as the design pillars (Google, Twitter, etc) establish what they believe good design is. 

The trick: testing.  If you have the budget (and you should!) Hire a UX/UI consultant to come in and take a look at things.  Or, if you’re strapped, hire a few joe schmoes to surf through your site.  Give them a few clear goals, and watch what happens (don’t help them!).  If they are confused by too much information, take stuff away.  However, if they have to dig through nothingness to get to their data, put some back in.  It’s a fine line, but once you get out of the valley, you emerge onto something truly wonderful.

Categories: Design

Sideblog Test

Testing asides

Categories: Asides

Personally Fit by Loretta

Loretta Evans and the Personally Fit crew wanted a website that was as swanky as their salon.  With a lot of customized elements such as dynamic navigation, sidebars that change for every page, and a great place to list their team members, you better believe this site (just like their clients) got the star treatment.

Categories: Portfolio

School Security Blog

School Security is no joke.  So when Ken Trump wanted a fresh new look for his blog that would be visually stimulating, and yet still get his point across, I took up the challenge.  The result is a clean, easy-to-read visual treat for the eyes.

Categories: Portfolio

The Periscope Group

When Aaron and Mark over at The Periscope Group approached me about a cool, social media friendly site for their company and blog, I jumped on the chance.  What emerged is a cool-blue tranquil site that hides a barrage of social media goodness.  The most fun part? Click on the author’s names and it takes you to a fully customized author page complete with social media links that are pulled straight from their profile.  Easy-peasy.

Categories: Portfolio

How to Create a Dynamic Sidebar Controlled with Custom Fields in WordPress

OK, so it’s not the most original title in the world, but it gets the point across :)

I’ve been working with the fantastic Jeff Brown and the Way-FM crew to create a site for their Nashville presence that will allow them super-quick, easy content management and a place they can post local stories and events.  WordPress, of course, is the logical choice, but then they presented me with an interesting conundrum: make their “jock” bio pages fun and engaging.  And make it have all of their social bells and whistles on it.

I took up the challenge.

And honestly, it’s super-freakin’ easy to do.

Our to do list:

  • Define a global variable in WordPress that will carry outside of the post loop
  • Create the custom field, and set the key names
  • Create a template tag that will showcase only the custom field data I want
  • Create an IF statement to, if there’s nothing in the field, collapse the field (the cool part!)

Step 1: Define our Global Variable

A Global Variable (looks like this: $variable) is basically a proxy for some other piece of code.  When we set one, and we can set a variable to anything we want, we’re saying “Instead of saying this long random code string, we’re going to say one word and a dollar sign.  Makes for much easier querying in WordPress.

Look for the code line:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

Right after that, add this line:

<?php global $globalvar; $globalvar = $post->ID; ?>

You can name it whatever you want, just make sure to carry the new name throughout the code.

Step 2: Create the custom fields

Remember how to create custom fields?  Below the post editor look for these boxes:

image

If you’ve never created a field, that will be blank.  Enter in your key (the name) and the value and hit “update”.  The yellow flash will tell you it was a success.  Remember that key name: it’ll come in handy later </resident Evil>

Step 3: Create a template tag to call the data.

I’m going to keep a standard format to these, just for ease of use.  I’ve formatted this like a normal sidebar widget is, just so I can have consistency between the main site and these special pages.

Head over to the sidebar.php file (or whatever file you want to drop this code into) in the Appearance > Editor. 

<?php $globalvarcheck=get_post_meta($globalvar, ‘keyname’, true); ?>

<li class=”widget”>
    <h4 class=”widgettitle”>Facebook</h4>
      <?php echo $globalvarcheck ?>

    </li>

get_post_meta is our tag of choice.  There are three, comma separated options: 1) Post ID, 2) key name, and 3) do we want to display it, or queue it in an array.  Basically, we call another global variable to specifically call the first variable as the post id, and give it the correct key name to make sure we call the right variable.

Step 4: Preventing Empty Widgets with an If Statement

But, Mitch, what happens if we don’t have a value set for a key? Never fear.  You can use a simple check with the same global variable to only display the data if that custom field has information in it. 

Here’s a facebook widget I developed (so you can drop in a Fan Page box) and showcase it on a particular page.  It shows the full IF statement with some example verbage:

<!–Facebook Widget Start–>
<?php $facebookcheck=get_post_meta($globalvar, ‘facebook’, true); ?>
    <?php if ( $facebookcheck ) { ?>

<li class=”widget”>
    <h4 class=”widgettitle”>Facebook</h4>
      <?php echo $facebookcheck ?>

    </li>
<?php  } ?>
<!–Facebook Widget End—>

Usage

Obviously, dropping in random social media widgets is a great way to use this, but I have a bonus for all you twitter-ites out there.  Ricardo González created a plugin called Twitter for WordPress, and it’s one of the few that uses template tags as a way of insertion (you see where this is going?):

<!–Twitter Widget Start–>
<?php $twittercheck=get_post_meta($globalvar, ‘twitter’, true); ?>
    <?php if ( $twittercheck ) { ?>

<li class=”widget”>
    <h4 class=”widgettitle”>Latest Tweets</h4>
     <?php twitter_messages($key_1_value = get_post_meta($twitterID, ‘twitter’, true), 5); ?>

    </li>
<?php  } ?>
<!–Twitter Widget End—>

I know that looks like a lot of code, but I basically embedded one template tag in another.  The first value in the twitter_messages tag is the global variable calling a twitter username.  The second calls the number of tweets.  Basically, enter in a twitter username, and if you do, this will display 5 tweets from it.  Pretty cool eh?

I can’t show the full site example because it’s not launched yet, but here’s a sneak peek at the new Way-FM site, and this code in action:

image

Categories: Tutorial, WordPress

Yahoo Publisher is going Away

I had signed up to test some ads on another blog with the Yahoo Publisher network.  I wasn’t too impressed, and took the ads down quickly, but kept the account, just in case.

Well, today I got this email:

Dear Publisher,
Yahoo! continuously evaluates and prioritizes our products and services, in alignment with business goals and our continued commitment to deliver the best consumer and advertiser experiences. After conducting an extensive review of the Yahoo! Publisher Network beta program, we have decided to close the program effective April 30, 2010. We expect to deliver final publisher payments for the month ending April 30, 2010 to publishers no later than May 31, 2010. All publishers eligible for 1099s for the 2010 tax year will have those mailed by January 31, 2011.
Because our content will no longer be delivered to your ad unit spaces after April 30, 2010, we recommend removing all YPN ad code from your pages by that date.
For the opportunity to continue earning revenue, we suggest using Chitika, a leading advertising network that syndicates Yahoo! Content Match and Sponsored Search ads. Chitika has set up a special process for YPNO beta publishers to participate in its platform. Click here for more information.
We thank you for your participation in the Yahoo! Publisher Network beta. If you have any questions regarding this announcement, please contact our Support Team at (866) 785-2636, Monday through Friday from 7:00 a.m. to 5:00 p.m. PDT.

Sincerely,
Your Partners at Yahoo!

Looks like Yahoo! is shutting down the operation for good.

Categories: News

The Location War: Mid-Battle Report

So, as promised a few weeks ago on Twitter, I decided to give a few services a try, and weed out the ones that I felt like weren’t serving my purpose well.  After almost a month of testing, I’ve finally narrowed it down to the two top contenders: Foursquare and Gowalla.

IF all things continue as they are, however, Foursquare is likely to be my contender of choice.

Why?  Because I can actually use it everywhere.

Don’t get me wrong.  I love Gowalla.  I think it has a nicer interface, its “trips” section lets you get out and explore major cities, and the concept of items intrigues me (it could allow for a lottery type system to reward people who visit your store and receive your item, for example). But, for the life of me, I can’t get the freakin’ GPS to work all the time.

Actually, I can’t get it to work nearly half the time.

Foursquare, without fail, lets me check in to every single place I go to.  Gowalla’s GPS, while somewhat good, still lacks because it’s very off-center.  A Gowalla check-in could get me anywhere from 250 – 500 meters off location.

So, for now, Foursquare has my attention.  If Gowalla can get its GPS onpoint, then it has a real chance, but until then, if I can’t use it… well, I won’t.

NOTE: I didn’t make this decision because it’s foursquare day, but it is very fitting.  Happy Foursquare Day!

Categories: Social Media