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">
<?php
    $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 ?>
    </a>
    <p><?php echo $category->description ?></p>
</li>
<li class="col2">
    <?php echo $category->count ?>
</li>
<li class="col3">
    <!-- comment count here -->
</li>
<li class="col4">
    <!-- last pub date here -->
</li>

<?php } ?>
</ul>

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

 
discard

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

Browse other questions tagged or ask your own question.