Hello @Cormoran42,
You will need to have this structure:
- DIV -> this is your Looper Provider Current Terms to get the current terms with Looper Consumer set to 1
- Posts - Looper Provider Query String which will contain our query
- Post - Looper Consumer to display the related post items
Query Args:
$tax_query[] = array(
'tax_query' => array(
array(
'taxonomy' => 'plantes_sauvages',
'field' => 'slug',
'terms' => '{{dc:term:slug}}',
'operator' => 'IN',
)
),
);
$query = array(
'post_type' => 'post',
'post_status' => 'publish',
'ignore_sticky_posts' => 1,
'post__not_in' => array( '{{dc:post:id}}' ),
'posts_per_page' => 5,
'orderby' => 'title',
'order' => 'desc',
'tax_query' => $tax_query
);
var_dump( http_build_query( $query ) );
We need to include 'post__not_in' => array( '{{dc:post:id}}' )
so that the current post item will not be included. So the final query string will be:
post_type=post&post_status=publish&post__not_in%5B0%5D={{dc:post:id}}&ignore_sticky_posts=1&posts_per_page=5&orderby=title&order=desc&tax_query%5B0%5D%5Btax_query%5D%5B0%5D%5Btaxonomy%5D=plantes_sauvages&tax_query%5B0%5D%5Btax_query%5D%5B0%5D%5Bfield%5D=slug&tax_query%5B0%5D%5Btax_query%5D%5B0%5D%5Bterms%5D={{dc:term:slug}}&tax_query%5B0%5D%5Btax_query%5D%5B0%5D%5Boperator%5D=IN
Kindly let us know how it goes.