taxonomy with slides So, first of all, i'm sorry for my bad English. I'm working on this institutional project where we don't need to use woo-commerce plugin, so we create a new post type like products and their taxonomies. What we need to do now is a slider where have all taxonomies and shows only one in active slide and below this slide, display all the products related in this taxonomy active slide. I've tried do the loop and catch the slug taxonomies and echo out the products but it does not worked. There 's this image attached for more clarity and understanding.
I've tried everything and nothing works so far... and i got this, please don't judge my code, i'm just an intern! lol
<div class="swiper-wrapper">
<!-- Slides -->
<?php
$tax = 'cultura';
$oterm = get_queried_object()->slug;
$term = get_term_by('slug', $oterm, $tax);
$termChildren = get_term_children($term->term_id, $tax);
$wp_query = new WP_Query();
$wp_query->query(
array(
'posts_per_page' => '5',
'tax_query' => array(
array(
'taxonomy' => $tax,
'field' => 'slug',
'terms' => $oterm
),
array(
'taxonomy' => $tax,
'field' => 'id',
'terms' => $termChildren,
'operator' => 'NOT IN'
)
)
)
);
if ($wp_query->have_posts()) :
while ($wp_query->have_posts()) :
the_post(); ?>
<div class="swiper-slide">
<p>
<a href="<?php echo the_permalink(); ?>">
<?php the_post_thumbnail('thumb-blog'); ?>
</a>
</p>
<p>
<a href="<?php echo the_permalink(); ?>">
<?php the_title(); ?>
</a>
</p>
</div>
<?php endwhile;
else : ?></div>
<p>Nada encontrado</p>
<?php
endif;
?>
The expected result is to make work a slider where the slides are the taxonomy title and thumbnail and below this thumbnail display all the products related of this active taxonomy slide. Like the image attached.