Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How do I get the comment count for a subcategory in this loop? So every child category of 225 had comments. That amount I want to list per child.

Tried some stuff with get_comments, but unsuccessful due lack of php skill.

<ul class="forum_topics">
    $args = array(
        'child_of' =>225,
        'orderby' => 'name',
        'order' => 'ASC'

    $categories = get_categories($args);
        foreach($categories as $category) { 

<li class="col1">
    <a href="<?php get_category_link( $category->term_id ); ?>">
        <?php echo $category->name ?>
    <p><?php echo $category->description ?></p>
<li class="col2">
    <?php echo $category->count ?>
<li class="col3">
    <!-- comment count here -->
<li class="col4">
    <!-- last pub date here -->

<?php } ?>

And than the last column gives me troubles as wel... There I want the post date from the last entry in that child category.

Cheers, Paul

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.