define('DISALLOW_FILE_EDIT', true); Ajax Calendar – Widgetized – unFocus Projects – Kevin Newman and Ken Newman

Ajax Calendar – Widgetized

Update: This information applies to Giraffe AJAX Calendar 2.3.1. AJAX Calendar 2.4 was released on September 3, 2007. This information is incompatible with that new version.

Update 2: It seems that this new version is supposed to simply replace the functionality of the old Calendar, without requiring any extra work (so you’d just use the old Calendar Widget, and get the new functionality after the plugin is enabled). So far, I haven’t been able to get the Ajaxy stuff to work, although I can tell that it’s installed, because the calendar is wider in this theme with the new Calendar plugin.

While surfing the web aimlessly, I came across the Urban Giraffe Ajax Calendar plugin for WordPress. It’s not set up to take advantage of WordPress’s built-in Widget support, so I thought I’d add the necessary bits to make it work. Here’s how to do it.

Download the plugin, and add the following code to the bottom of ajax-calendar.php:
[cc lang=’php’ ]
function giraffe_ajax_register_widget() {

if ( !function_exists(‘register_sidebar_widget’) || !function_exists(‘register_widget_control’) )
return; register_sidebar_widget(‘Ajax Calendar’, ‘ajax_calendar’);

}add_action(‘plugins_loaded’, ‘giraffe_ajax_register_widget’);
[/cc]
Additionally, you can avoid a duplicate prototype.js header link, by replacing these lines:
[cc lang=’php’ ]
if ($giraffe_ajax_prototype)
add_action (‘wp_head’, ‘giraffe_ajax_head’);
[/cc]
with these:
[cc lang=’php’ ]
if (function_exists(‘wp_enqueue_script’))
wp_enqueue_script(‘prototype’);
else if ($giraffe_ajax_prototype)
add_action (‘wp_head’, ‘giraffe_ajax_head’);
[/cc]
You can see it working in my sidebar. And I didn’t even have to modify this theme. ๐Ÿ™‚

Author: Kevin Newman

I'm the lead developer at adcSTUDIO located in Kingston NY (in Livingston Manor NY before that). I do all kinds of things there, from robust server side work to the much more enjoyable client side development in HTML/JavaScript/Flash (RIAs, HTML5, etc.) and all the other tech-buzz-phrases of the moment. My brother came up with the idea for unFocus.com which was originally meant be a place to discuss and blog about whatever topics we both found interesting, from politics to technology, to art and design. Time was scarce, and I need a place to host History Keeper, and unFocus Projects - a sub focus of unfocus.com was born, and eventually migrated to the font page. Oh, and I'm on Twitter (@Touvan) and Google+.

3 thoughts on “Ajax Calendar – Widgetized”

  1. Sorry, but there is no code like this in the current version of the AJAX calendar plugin:

    if ($giraffe_ajax_prototype)
    add_action (‘wp_head’, ‘giraffe_ajax_head’);

    If I only copy the widget code into ajax-calendar.php the calendar show up, but don’t work.

  2. It looks like there’s a new version of Ajax Calendar posted at the above link (updated Sept. 3). I’ll take a look and maybe update this post or post a new one or something in a bit.

    Thanks! ๐Ÿ™‚

  3. No worries.
    I have the same problems like you. I avenโ€™t been able to get the Ajaxy stuff to work, but I’m pretty sure it’s installed.

    Also it seems the calendar plugin won’t work with the lightbox2 plugin.

Leave a Reply

Your email address will not be published. Required fields are marked *