1

I build a review site with Wordpress. I created a custom post type called "Reviews", inside this, theres two taxonomy, one called "Genres" and one called "Types". Inside the Genres, i have a couple of subcategory, action, comedy, drama etc... and inside the Types, i have 2 subcategory: Movies and TV Shows

I want to create a navigation on my homepage like this:

  • Movies
    • Action
    • Comedy
    • Drama
  • Tv Show
    • Action
    • Comedy
    • Drama

And of course, if i click on the Tv Shows/Action, i only want to display all of the reviews inside the Tv Shows category which has an Action genre, and only the TV show, not the movies.

What is the easiest solution to do this?

1 Answer 1

0

The way that I would approach it is using the tax_query to create a query that looks for both the correct genre and type. For example, to query all Movies that are Drama:

$myquery['tax_query'] = array(
    array(
        'taxonomy' => 'genre',
        'terms' => array('drama'),
        'field' => 'slug',
    ),
    array(
        'taxonomy' => 'type',
        'terms' => array('movie'),
        'field' => 'slug',
    ),
);
query_posts($myquery);

Hopefully that will get you started in the right direction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.