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.
* 26 August 2010: Changed `! is_page() && ! is_single()` to `! is_singular()`.