apamphilon

Show a list of terms that are in the same term as current page

<?php 
    //product_type = taxonomy
    $terms = get_the_terms(get_the_id(), 'product_type');

    $term_slug = $terms[0]->slug;
    // print_a($term_slug);

    $terms_list = get_posts(array(
        'post_type' => 'product',
        'product_type' => $term_slug,
        'posts_per_page' => -1
    ));

    foreach($terms_list as $term) {
        print_a($term->post_title);
    }
?>

Comments: