Category Archives: APIs
FaceBook Share
/*
Plugin Name: Very Simple FaceBook Share
Plugin URI: http://www.paulOr.net/facebook-share/
Description: A very simple shortcode plugin which will allow you to put a facebook sharecode on any page or post via [fbshare] - you can also style it any way with [fbshare style="color:#ffffff; text-decoration: underline;"]
Author: Paul Fraser
Version: 1
Author URI: http://www.paulOr.net
*/
function FBShare($params, $content = null) {
extract(shortcode_atts(array(
'style' => ''
), $params));
return '<a '.($style == '' ? '' : " style=\"$style\"").' name="fb_share"></a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>';
}
add_shortcode('fbshare','FBShare');
Very simple facebook share plugin which allows you to just add a shortcode to a page or post & style it via [fbshare style="blah: blah;"]
Download: FBShare.php
VanBook 2.0

Back in the days of 2008 when Vanilla Forums were newish on the scene and just taking off, someone by the name of dkodr in the Vanilla Community created a theme called VanBook losly based on the FaceBook Developers pages.
Recently I’ve been doing a lot of tinkering with Vanilla to get myself up to speed with Gardens APIs and such – I also decided to create my own theme, well… I decided to recreate probably the single best Vanilla 1 theme that was available, Vanbook.
So I’m working on VanBook 2.0, there has been no mention of this in the Vanilla Community – which as of about a year ago I myself have not been active on. I did ask OP if he minded me tinkering with his theme quite a while ago and he said he didn’t mind.
At the moment there are not really any amazing themes available for Vanilla and I’m hoping this rehash of a once popular theme gets some good reception.
Really Simple WordPress Queries
When I was learning about WordPress and how to manipulate data, it seemed like everyone had an opinion on how to do what is actually very simple queries. Take for example; Running a custom query to get posts from a certain category. If you were to Google that you would be returned with pretty much thousands of example code, some working, some not. My 2 pence; Its this simple:
<?php $bloggy = new WP_Query("cat=5&showposts=5"); while($bloggy->have_posts()) : $bloggy->the_post();?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
<?php the_excerpt(); ?>
<?php endwhile; ?>
Where cat=5; change to the category ID which you want to get the posts from & showsposts=5 should be changed to however many posts you would like to see per page. It really is that simple. Now think of the possibilities of it if you were to create a shortcode from it and pass variables like [showposts cat=5 posts=10] anywhere on any page.
DailyBooth API: Most Recent Snap
TheĀ DailyBooth API is a land yet to be chartered when it comes to developing on it. Its very much still in beta, andĀ Jon orRyan might even shout at me for starting to document into at this stage. But i’m willing to risk it!
Overall, DailyBooth API is pretty straight forward and really quite simple, which is great. Ill quickly show you how to grab your most recent snap via the API.
## GET THE USERS USER ID VIA THERE USERNAME
$userID = json_decode(file_get_contents('http://api.dailybooth.com/v1/user/id/paul.json'));
## NOW COLLECT THE IMAGES FROM THERE FEED, VIA THERE USERID
$feed = json_decode(file_get_contents('http://api.dailybooth.com/v1/user/pictures/'.$userID[0].'.json'));
## PRINT OUT THE IMAGE
echo '<img src="'.$feed[0]->urls->medium.'" />';
