Categories

Meta

Month: July 2010

The WordPress Categories Widget currently only handles the `category` taxonomy. I’ve modified it to allow the user to select a taxonomy, and tied in the Tag Cloud Widget code to give the user the choice of display formats: list, dropdown, and cloud. Multiple instances are possible, providing the user with an easy method for displaying links to user-built taxonomy terms.

`preg_replace_callback()` is used to fix the JavaScript for the dropdown menu; instead of generating the default `?query_var=value` format, it uses `get_term_link()` to generate the term URL.

By default or design, the WordPress function `get_calendar()`[^1] does not handle post types other than `post`. I’ve updated it as the standalone function `ucc_get_calendar()` to allow it to accept a `$post_types` array; the included filter function `ucc_get_calendar_filter()` will allow for seamless integration via `functions.php` without requiring additional editing of Theme templates. (Note that the filter will also apply to the Calendar Widget’s output.)

Again with the custom post type extensions. This function lets the native WordPress `wp_get_archives()` [^1] [^2] know about public custom post types; just add it to the `functions.php` of your theme. Of note: the builtin `link` post type can be included at the `array_merge()` point; I just had no use for it.

After I had created several custom taxonomies and post types, adding more by directly calling the `register_taxonomy`[^1] and `register_post_type`[^2] functions seemed like a huge waste of space. The following functions create a shortcut for registering taxonomies and custom post types in WordPress; just choose whether you’d like the taxonomy to resemble Post Tags or Categories when calling the function `ucc_register_taxonomy`, and specify an array of taxonomies for `ucc_register_post_type`.

I love the [Post Editor Buttons](http://wordpress.org/extend/plugins/post-editor-buttons/) plugin for WordPress by [Oren Yomtov](http://orenyomtov.com/). It makes it easy to extend the Post Editor without needing to resort to hacking `quicktags.js`.