WP Custom Taxonomies not displaying in query_posts();

I have 2 sets of Taxonomies for a site, the default WP Categories, and another that I created via functions.php for Content Type (‘type’)

add_action( 'init', 'content_taxonomy', 0 );
function content_taxonomy() {

register_taxonomy(
'type',
'post',
array(
    'hierarchical' => true,
    'label' => 'Type of Content',
    'query_var' => true,
    'rewrite' => false
    )
  );
};

Then, in my category.php file I’d like to display all posts in a single WP Category, and then be able to filter them by the Content Type category below it (Posts that link to Videos, Blog Posts, Articles, etc). So, My Loop is as follows:

Read More
$category = get_category( get_query_var( 'cat' ) );
$cat_id = $category->cat_ID;

query_posts('cat=".$cat_id.", 121') // 121 Being the Video Custom Taxonomy

And then I follow up with the Loop. However, I can’t seem to make it show the Custom Taxonomy Category, it’s only grabbing the WP Category.

Related posts

Leave a Reply

1 comment

  1. It appears that you are treating your custom taxonomy as if it were just another category. If your cat was, say, 7, your code would evaluate to:

    query_posts('cat=7, 121');
    

    Shouldn’t your query_posts line look something like this:

    query_posts( 'cat=' . $cat_id . '&type=video' );