WP Fullcalendar – A Fully Functional Events Calendar for WordPress

I’ve used Adam Shaw’s fantastic jQuery plugin called fullcalendar on several projects and I love its flexibility and extensibility. It doesn’t try to be all things to all projects but provides the hooks for you to extend its functionality if you need to.

I got to thinking about how much I’d love to be able to publish events and use a calendar like fullcalendar right within WordPress. Enter WP-Fullcalendar.

This WordPress plugin will enable you to create events right from your WordPress administration console and have them published using fullcalendar right inside a post or a page.

Here’s an example where I’m using an external events provider from another project I’m working on at http://www/mlynn.org/training_calendar. This project also uses fullcalendar – but not within the WordPress context.

[wp-fullcalendar]

The plugin provides an options page that lets you specify an external events source.  An “events source” can be a php script which provides the data that make up an event in json format.  Here’s a look at what the data for an event looks like:

[
{
"id":111,
"title":"Event1",
"start":"2010-12-10",
"url":"http://yahoo.com/"
},
{
"id":222,
"title":"Event2",
"start":"2010-12-20",
"end":"2010-12-22",
"url":"http://yahoo.com/"
}
]

You’ll notice the key data elements are id, title, start, end and url. Creating a custom events source provider is as simply as writing a php script to echo these data elements. Adam Shaw includes a demo / example with his fullcalendar package. I modified this example to work with older versions (prior to 5.2) of php.

[php]
$year = date(‘Y’);
$month = date(‘m’);

$tmp = array(

array(
‘id’ => 111,
‘title’ => "Event1",
‘start’ => "$year-$month-10",
‘url’ => "http://yahoo.com/"
),

array(
‘id’ => 222,
‘title’ => "Event2",
‘start’ => "$year-$month-20",
‘end’ => "$year-$month-22",
‘url’ => "http://yahoo.com/"
)

);
if (version_compare(PHP_VERSION,"5.2","<"))
{
require_once("./includes/JSON.php"); //if php<5.2 need JSON class
$json = new Services_JSON();//instantiate new json object
$data=$json->encode($tmp); //encode the data in json format
} else
{
$data = json_encode($tmp); //encode the data in json format
}
echo $data;
[/php]

I should have approval from WordPress to host and publish this plugin shortly – I’ll update this page when it’s released.

Advertisements
Tagged , ,

One thought on “WP Fullcalendar – A Fully Functional Events Calendar for WordPress

  1. Ken Westfall says:

    Did you ever publish this? I’d love to use it! If so, let me know!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: