tax_query and wp_query how-to?
-
So. I’m writing this section of a website that needs to display job opportunities that i’ve registered as a custom post type with a hierarchical taxonomy that indicates job levels.
of course, by inserting this before the loop, i can get it to display only the custom posts marked with the “level1 and level2” taxonomy:
$levelquery = array( 'tax_query' => array( array( 'taxonomy' => 'vagas_tipo', 'field' => 'slug', 'terms' => array('level1','level2'), ), ) ); $jobquery = new WP_Query($levelquery);
problem is: I don’t want to hardcode levels here, since the client might just use the WP interface to add more levels later on, and at the same time, i want to display them all in a single page, either as separate loops (one for each taxonomy term) or as a single loop ordered by taxonomies so my result would end up as:
> level1
<!– all the job-posts marked as level1 –>>level2
<!– all the job-posts marked as level2 –>and so on.
Can anyone point me to the light?
- The topic ‘tax_query and wp_query how-to?’ is closed to new replies.