Skip to main content
added 38 characters in body
Source Link

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: iSO, GX700, etc..).

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' (iSO, GX700, etc..).

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...

added 390 characters in body
Source Link

Screenshot

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' (iSO, GX700, etc..).

Screenshot

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' (iSO, GX700, etc..).

deleted 8 characters in body
Source Link
<?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' => 'nommarque''brand',
                        'field' => 'slug',
                        'terms' => $post_marque
                    )
                    ,
                    array(
                        'taxonomy' => 'nommateriel''product',
                        'field' => 'slug',
                        'terms' => $post_product
                    )
                )
            );
            
            the_permalink();
            var_dump($taxquery);
            
            endwhile;  wp_reset_postdata(); ?>
<?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' => 'nommarque',
                        'field' => 'slug',
                        'terms' => $post_marque
                    )
                    ,
                    array(
                        'taxonomy' => 'nommateriel',
                        'field' => 'slug',
                        'terms' => $post_product
                    )
                )
            );
            
            the_permalink();
            var_dump($taxquery);
            
            endwhile;  wp_reset_postdata(); ?>
<?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(); ?>
edited tags; edited title
Link
fuxia
  • 107.1k
  • 38
  • 255
  • 459
Loading
Source Link
Loading