Support » Fixing WordPress » comments_number() not working after Theme Unit Test import

  • Hi, everybody! I stumbled across strange problem when creating a theme for WordPress. I have written a simple function in my comments.php file consisting of the following code:

    <?php if ( have_comments() ) :
            if ( ! empty($comments_by_type['comment']) ) : ?> 
                  <?php comments_number('<span>' . __("No","mytheme") . '</span> ' . __("Replies","mytheme") . '', '<span>' . __("1","mytheme") . '</span> ' . __("Reply","mytheme") . '', '<span>%</span> ' . __("Replies","mytheme") );?> <?php _e("to","mytheme"); ?> “<?php the_title(); ?>”</h3>
    	       <ol class="commentlist">
                   <?php wp_list_comments('type=comment&callback=my_comments'); ?>
    <?php endif; ?>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]


    And after importing the Theme Unit Test XML file and opening the post that is full of comments, it’s displaying them, but the heading is “No Replies”.
    However after I manually post a new comment, it refreshes and shows the number of comments as it should be.

    Does anyone have any idea why is that happening and is it only me?

  • The topic ‘comments_number() not working after Theme Unit Test import’ is closed to new replies.