I have two taxonomy : brand and product. In single sidebar I am displaying the brand and product of the post in the sidebar but I would like to display all the other product of the current taxonomy term brand. This is what I'am going to try but I have no error and it return nothing :
<?php // get current taxonomy product term $post_product = get_the_term_list($post->ID, 'product', '', ', '); echo 'Product : '.$post_marque; // get current taxonomy brand term $post_brand = get_the_term_list($post->ID, 'brand', '', ', '); echo 'Brand : '.$post_brand; // make the custom query $do_not_duplicate = $post->ID; $taxquery = new WP_Query( $taxquery_args ); while($taxquery->have_posts()) : $taxquery->the_post(); if( $post->ID == $do_not_duplicate ) continue; $taxquery_args = array( 'post_type' => 'any', 'posts_per_page' => 10, 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'brand', 'field' => 'slug', 'terms' => $post_marque ) , array( 'taxonomy' => 'product', 'field' => 'slug', 'terms' => $post_product ) ) ); the_permalink(); var_dump($taxquery); endwhile; wp_reset_postdata(); ?>
How to return all taxonomy product terms execpt current post term who have current taxonomy brand term of the post ? Is it possible to return term->name and term-slug ?
This is a screenshot, for exemple current post will have taxonomy term brand = Antec and taxonomy product term = P280 and I would like to have all product terms with brand term 'Antec' by term->name except 'P280', so the result shoud return this terms : iSO, GX700, etc...