WordPress 2.8 Widget API

Sunday, 14th June 2009

I love the new widgets API in WordPress 2.8

I followed the excellent tutorial at WPengineer.com which gives a great overview about how to create a widget using the new API. Initially, the widget I created by following the guide seemed to ‘crash’ WordPress when I installed it. After a little investigation I tracked this down to the following…

1
2
3
4
function widget_myuniquewidget_register() {
   register_sidebar_widget('My Unique Widget','widget_myuniquewidget');
}
<strong>add_action('init', widget_myuniquewidget_register);</strong>

You must initialise the register_sidebar_widget function by hooking into the ‘init’ action. Failure to do so means the function is called too early which will cause problems. For more information read WordPress Widgets API on the WordPress Codex.


Loading XML files in Flash over an SSL Connection in Internet Explorer

Thursday, 27th March 2008

If you have a Flash site which loads dynamically generated XML file using SSL, you may have experienced this problem.

Loading XML files in Flash over an SSL Connection fails in Internet Explorer if the Pragma:no-cache or Cache-control:no-cache HTTP headers are set on the XML file. By default, all dynamically generated files are returned by the server with the Pragma:no-cache header so that they are not cached by the browser.

To ensure that Flash loads the XML successfully, you should use the following function in PHP near the top of your code:

session_cache_limiter('private_no_expire');