WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wp2.7 BUG on - wp_list_comments() (4 posts)

  1. Rami Yushuvaev
    Member
    Posted 5 years ago #

    WP2.7 BUG?

    i have a post with 1 comment and one pingback.

    using <?php wp_list_comments(); ?> i see both of them and <?php comments_number(); ?> returns - "2 Responses".

    but when i use <?php wp_list_comments('type=comment'); ?> i see only the comment whitout the pingback, but the <?php comments_number(); ?>` it still returning "2 Responses".

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    That's not a bug, just not an obvious piece of functionality. Notice that it says "responses"? A pingback or trackback is a type of response. It's also considered to be a type of comment, just one left on some other blog.

    To do this sort of thing correctly:

    1. In your actual templates, where you call the "comments_template" function, change it to this:
    comments_template('/comments.php',true);
    The "true" part forces it to pre-separate the comments into types. This takes extra time, so you only want to do it when you know you're going to be separating them out anyway in the comments.php.

    2. To display the comments number, do this sort of thing:

    global $wp_query;
    echo count($wp_query->comments_by_type['pings']);
    echo count($wp_query->comments_by_type['comment']);
    echo count($wp_query->comments_by_type['pingback']);
    echo count($wp_query->comments_by_type['trackback']);

    You can use any of those echo's to display the count for just that one type.

  3. corpodibacco
    Member
    Posted 5 years ago #

    This is a bug, because it also affects the pagination of the comments.

    If I separate comments and pings, and apply pagination (two things you can do with WP 2.7), the pagination will still consider comments+pings, producing always one or two empty pages at the end.

  4. Gary LaPointe
    Member
    Posted 5 years ago #

    I'm using 2.8.2 and I'm getting the opposite.

    I've got a comment and a trackback and it only says one response.

    Gary
    http://GarySaid.com/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags