how to use custom taxonomies in query_posts (3 posts)

  1. sonill
    Posted 5 years ago #

    can anyone please provide me the easiest way to use the custom taxonomies in query_posts.

    i created custom taxonomies like this:

    register_taxonomy( 'products-categories', 'post',
    						  	array( 'hierarchical' => true, 'label' => 'Product Categories', 'query_var' => true, 'rewrite' => true )

    hoping for easy solution, thanks

  2. borantula
    Posted 5 years ago #

    <?php $myproducts=array(
              'product-categories' => 'bubblegums'
      ); ?>
    <?php query_posts($myproducts); ?>
    //and the loop comes next
  3. sonill
    Posted 5 years ago #

    thank you for help borantula but the above code does not work.
    It fetched every thing, even those posts which are of other categories.

    Is there any working code sample please.

Topic Closed

This topic has been closed to new replies.

About this Topic