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.


Stylish Categories for WP e-Commerce

Wednesday, 22nd April 2009

I’ve made my first contribution to the WP e-Commerce plugin – my first contribution to an open source project…

It’s a great e-commerce plugin for WordPress but there were a few visual things niggling me that I thought should be sorted out – mainly the way that the widget for showing categories was not styled the same way as the WordPress default widgets.

Fixing the issue was just a case of making a couple of tweaks to the HTML; changing some square brackets to normal brackets and removing some bold styling.

Nothing revolutionary there, but it should now look a whole lot better with your default WordPress theme without making any modifications…

The current version in development WP e-Commerce 3.7 is looking great, with an overhaul of the user interface to bring it into line with WordPress 2.7, a complete reorganisation of the code making it easier for us developers, and a new template engine which works along the same lines at the WordPress Loop so that theme authors can now get in on the act without having to delve too far into the plugin’s code.