[Resolved] Displaying comment and ping counts separately
I’m trying to display the comment count above my comment list in
comments.phpwithout the pings included. The
comments_number()function doesn’t allow for displaying them separately (why?), so I need to access the
Several examples on the web show this being done like this:
<?php if ( have_comments() ) : global $wp_query; ?> <h3 id="comments"><?php echo count($wp_query->comments_by_type['comment']); ?> comments</h3> <ol class="commentlist"> <?php wp_list_comments('type=comment&callback=cleanr_theme_comment'); ?> </ol>
However, this doesn’t work.
After experimenting, I discovered that I’m able to access the
$wp_queryobject after calling
wp_list_comments()(looking at the code, that function declares
How can I access the
$wp_queryobject before calling
wp_list_comments(), so that I can gain access to the comment count without pings included?
- The topic ‘[Resolved] Displaying comment and ping counts separately’ is closed to new replies.