WordPress 3.0 adds custom post types to the Dashboard’s main navigation sidebar, but I wanted a quick overview of my custom post types and taxonomies in the Right Now widget, just like it currently has for Posts, Pages, Categories, and Tags. I used WordPress’s internal dashboard code to create similar entries for custom post types and taxonomies.
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.