Return to Snippet

Revision: 42801
at March 10, 2011 22:15 by nmyers


Initial Code
/**
 * To show custom types in categories
 */
add_filter('pre_get_posts', 'query_post_type');

function query_post_type($query) {
  if(is_category() || is_tag()) {
    $post_type = get_query_var('post_type');
	if($post_type)
	    $post_type = $post_type;
	else
	    $post_type = array('post','activities','nav_menu_item');
    $query->set('post_type',$post_type);
	return $query;
    }
}

Initial URL
http://tohtml.com/php/

Initial Description


Initial Title
wordpress show custom types in categories

Initial Tags
wordpress

Initial Language
PHP