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 A Custom Taxonomy Terms Widget To WordPress

Fix Post Editor Buttons character encoding mismatch

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

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 Fix Post Editor Buttons character encoding mismatch

Add custom post types to the Loop by adding an action to `pre_get_posts`

[deprecated permalink=”http://uncommoncontent.com/2012/01/28/add-custom-post-types-to-the-loop”]

I wrote this function to allow me to use custom post types in my blog without having to fine-tune each template for their inclusion. It checks the query to see if `post_type` is set; if it is not set (as it would be on a specific post type’s archive page), it includes all public post types.

Continue reading Add custom post types to the Loop by adding an action to `pre_get_posts`

Filter FeedWordPress syndicated posts into custom post types

I use [FeedWordPress](http://feedwordpress.radgeek.com/) to scrape my personal RSS feeds on various services into my WordPress blog as individual posts. Before the advent of [custom post types](http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress), I used categories and tags to separate these scraped posts from regular blog posts. However, it now seems more logical to add some of these posts as a custom post type.

Continue reading Filter FeedWordPress syndicated posts into custom post types