I think the best way to do this is using the loop, in the loop you need to get the terms for all associated posts.
<?php if (have_posts()) :
<while (have_posts()) : the_post();
//thecode
endwhile;
endif;
?>
I think the best way to do this is using the loop, in the loop you need to get the terms for all associated posts.
<?php if (have_posts()) :
<while (have_posts()) : the_post();
//thecode
endwhile;
endif;
?>