//getting the child categories
$allcats = get_categories('child_of='.get_query_var('cat'));
foreach ($allcats as $cat) :
$args = array(
'category__in' => array($cat->term_id)
);
$customInCatQuery = new WP_Query($args);
if ($customInCatQuery->have_posts()) :
echo '<div class="menupageContent">';
//GETTING THE IMAGES FROM THE PLUGIN SET ON THE POST PARENT
$terms = apply_filters( 'taxonomy-images-get-terms', '' );
if ( ! empty( $terms ) ) {
foreach( (array) $terms as $term ) {
if($term->term_id == $cat->term_id) {
echo wp_get_attachment_image( $term->image_id, 'menu' );
}
}
}
//DISPLAY THE NAME OF THE CATEGORY PARENT
echo '<h3>'.$cat->name.'</h3>';
echo '<ul>';
while ($customInCatQuery->have_posts()) : $customInCatQuery->the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php
endwhile;
echo '</ul></div><!--end menupageContent-->';
?>
<?php else :
echo 'No post published in:'.$cat->name;
endif;
wp_reset_query();
endforeach;
?>
<?php if ( $wp_query->max_num_pages > 1 ) : ?>
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'paradiso' ) ); ?></div>
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'paradiso' ) ); ?></div>
<?php endif; ?>