define('DISALLOW_FILE_EDIT', true); Widgets – unFocus Projects – Kevin Newman and Ken Newman http://www.unfocus.com Home of Scripts 'n Styles for WordPress, Backstage2D and History Keeper! Fri, 28 Aug 2009 17:31:22 +0000 en-US hourly 1 https://wordpress.org/?v=6.2.5 Ajax Calendar – Widgetized http://www.unfocus.com/2007/08/31/ajax-calendar-widgetized/ http://www.unfocus.com/2007/08/31/ajax-calendar-widgetized/#comments Fri, 31 Aug 2007 06:00:07 +0000 http://www.unfocus.com/projects/2007/08/31/ajax-calendar-widgetized/ Continue reading "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. 🙂

]]>
http://www.unfocus.com/2007/08/31/ajax-calendar-widgetized/feed/ 3