<div class="accordion" id="accordion2">
<?php
//get all children of category "General", then display posts in each cat
$taxonomy = 'category';
$param_type = 'category__in';
$cat_id = get_cat_ID('General');
$term_args=array(
'orderby' => 'name',
'order' => 'ASC',
'exclude' => 1,
'child_of' => $cat_id
);
$terms = get_terms($taxonomy,$term_args);
if ($terms) {
foreach( $terms as $term ) {
echo '<div class="accordion-group">';
$args=array(
"$param_type" => array($term->term_id),
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1,
//'caller_get_posts'=> 1 //?
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo '<div class="accordion-heading"><a class="accordion-toggle" data-toggle="collapse"
data-parent="#accordion2" href="#' . $term->term_id . '">' . $term->name . '</a></div><div id="' . $term->term_id .'" class="accordion-body collapse"><div class="accordion-inner">';
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php
endwhile;
echo '</div></div>';
}
echo '</div>';
}
}
wp_reset_query(); // Restore global post data stomped by the_post().
?>
</div>