Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

With the code below how is it possible to show the posts under each of the categories? Right now the code shows the name and a thumbnail for the category, but I'm trying to figure out how to list the posts for those categories under the category names too.

<?php $term = get_term_by( 'slug', get_query_var($wp_query->query_vars['taxonomy']), $wp_query->query_vars['taxonomy']); ?>
    <?php $categories = get_term_children( $term->term_id, 'product_cat' ); ?>
        <?php if ( sizeof( $categories ) ) : ?>
            <ul class="product_list">               
                <?php
                foreach ( $categories as $category ) {
                    $term = get_term_by( 'id', $category, 'product_cat' );
                    $title = $term->name;                       
                    $thumb = jigoshop_product_cat_image( $term->term_id );
                    if ( $thumb['thumb_id'] )
                        $thumb_image = wp_get_attachment_image( $thumb['thumb_id'], 'shop_small' );
                    else
                        $thumb_image = jigoshop_get_image_placeholder();
                    ?>
                    <li class="category">
                        <a href="<?php echo get_term_link( $term->slug, 'product_cat' ); ?>" title="<?php echo $title; ?>">
                            <div class="thumb"><?php echo $thumb_image; ?></div>
                            <div class="title"><strong><?php echo ( strlen( $title ) > 70 ) ? substr( $title , 0, 70) . '...' : $title; ?></strong></div>
                        </a>
                        <a href="<?php echo get_term_link( $term->slug, 'product_cat' ); ?>" class="button" title="<?php echo __('View', 'jigoshop') . ' ' . $title; ?>"><?php echo __('View', 'jigoshop'); ?></a>
                    </li>
                    <?php
                }
                ?>
            </ul>
            <div class="clear"></div>
        <?php else: ?>
            <?php jigoshop_get_template_part( 'loop', 'shop' ); ?>
            <?php do_action('jigoshop_pagination'); ?>
        <?php endif; ?>
share|improve this question

closed as too localized by toscho Jan 26 at 5:05

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

Browse other questions tagged or ask your own question.