Monthly Archives: July 2010

Adding A Custom Taxonomy Terms Widget To WordPress

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.

Continue reading

Adding Custom Post Types To get_calendar() And The Calendar Widget

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.)

Continue reading

Shortcut Functions For Registering Taxonomies And Post Types In WordPress

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.

Continue reading

Fix Post Editor Buttons character encoding mismatch

I love the Post Editor Buttons plugin for WordPress by Oren Yomtov. It makes it easy to extend the Post Editor without needing to resort to hacking quicktags.js.

One tiny drawback: sometimes I have character entity mismatches. Quicktags for special characters, such as ‘é’ , ‘–’ , ‘…’, work until the next time I add a quicktag via the PEB interface, when they are returned as ‘é’, ‘â��’, ‘â�¦’.

Continue reading