I'm in trouble with Bootstrap and Wordpress.
I want to get Taxonomy list to expand (show custom posts from Taxonomy). But it is hard!!!!
Its basically a custom sidebar
My code:
<h3>
Portfólio
</h3>
<?php
$catprod = get_terms( array(
'taxonomy' => 'categoria-produto',
'order' => 'DESC'
)); // Todas as categorias
$args = array(
'post_type' => 'produto'
);
$prodtype = new WP_Query($args);
?>
<div class="panel-group">
<div class="panel-heading">
<?php foreach( $catprod as $cat ) { ?>
<h3 class="panel-title">
<a data-toggle="collapse" href="#<?php echo $cat->slug ?>" class="accordion-toggle" data-parent="#accordion">
<?php echo $cat->name ?>
</a>
</h3>
<div id="<?php echo $cat->slug ?>" class="panel-collapse collapse in">
<div class="panel-body">
<?php foreach( $prodtype as $prod ) { ?>
<li>
<a href="<?php the_permalink() ?>">
<?php the_field('titulo') ?>
</a>
</li>
<?php } ?>
</div>
</div>
<?php } ?>
</div>
</div>
WP_Query
insideforeach
loop and usetax_query
as i mentioned in code snippet below