• Resolved mrwangkai

    (@mrwangkai)


    I’m currently employing a latest customized theme of Cognoblue and is running into some walls trying to figure out how my comment counter shows the exact same number on all the posts.

    My site is here: careace

    I narrowed it down to problem with theme because the issue does not exist if I switch it to a different theme.

    Am using this to show comment:
    <?php comments_popup_link(__('<strong>Comments (0)</strong>'), __('<strong>Comments (1)</strong>'), __('<strong>Comments (%)</strong>')); ?>

    The problem is, there is not problem with the code. Can anyone suggest where I should check next for problem?

    (Basically, from the code above, if I substitute any number with the % in Comments(%), the output would be: Comment (whatever # you have placed))

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • What happens if you use this code from the WordPress Default theme:

    <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>

    See Template_Tags/comments_popup_link

    Thread Starter mrwangkai

    (@mrwangkai)

    Thanks MichaelH,

    Same thing, it kept saying Comment (2).
    If I were to change the % in the above code to the number 9, the comment will say (9).

    Using the same code elsewhere, such as on an archive page with all the posts, the number of comment will display correctly (zero meant 0 and two meant 2).

    I figured it must be a problem with the theme for that particular section. It’s a customized theme where the original version does not consist this problem.

    Any other pointer from anyone? Greatly appreciate it!

    Thread Starter mrwangkai

    (@mrwangkai)

    Okay, i think i may know why.

    I have 2 php files included. one of them is doing query_posts and the other is trying to get_post. Now, when I make one of them invalid, the comment becomes normal.

    So my new question is how can you get posts (by using either function) to show articles in 2 different places on the same page?

    I used this for the first php file:

    <?php
    global $post;
    $myposts = get_posts('numberposts=5&category=9');
    foreach($myposts as $post) :
    ?>

    and this for the second php file:

    <?php query_posts('showposts=4&cat=24'); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    ...
    <?php endwhile; ?>
    <?php endif; ?>

    Thanks!

    Thread Starter mrwangkai

    (@mrwangkai)

    Anyone?

    Thread Starter mrwangkai

    (@mrwangkai)

    I used method provided here and it was resolved.

    https://perishablepress.com/press/2008/09/01/multiple-loops-and-multiple-columns-with-wordpress/

    Good resource too, MichaelH. ??

    case closed!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Comment counter shows the same number on all posts’ is closed to new replies.