Good morning (or evening),
I try to merge in a custom archive (taxonomy-$taxonomy.php) a double (?) query. Let's try to be clear :
I’d like to display all the posts from a taxonomy. Ok, it works.
//start by fetching the terms for 'progression' taxonomy
$terms = get_terms( 'progression', array(
'orderby' => 'asc',
'hide_empty' => 1
) );
And the query
// Run a query for each progression
foreach( $terms as $term ) {
$args = array(
'post_type' => array('my_custom_post', 'another_custom_post'),
'progression' => $term->slug,
);
$query = new WP_Query( $args );
// output the term name (here "day1", "day2"...)
echo $term->name;
// Start the Loop and output the titles
while ( $query->have_posts() ) : $query->the_post();
the_title();
endwhile;
// use reset postdata to restore original query
wp_reset_postdata();
} ?>
(of course, I didn't find this by myself... thanks this forum !)
BUT (that’s the problem) It displays every post with this tax. However, I would like to restrict my request to another taxonomy.
A second tax 'sport' => volley, tennis, basket...
Individually, it works. BUT, as soon as I try to combine the both criterias, I fail miserably.
I could write my code (with the second query and args, but it doesn't work, so, is it usefull ?) Thanks a lot for any help.