0

Live site

I'm using <?php comments_number( $zero, $one, $more ); ?> on home.php to display number of comments in the post-meta. Problem is, it's not showing the number despite there being one comment on that post. Any ideas what's causing the problem?

Here's post-meta for index.php:

<div class="post-meta">
                <p><?php the_date(); ?> | <?php the_tags('tags:', ', ', '<br />'); ?> | <?php comments_number( $zero, $one, $more ); ?> comments</p>
                <?php comments_template(); ?>
            </div><!-- end post-meta -->
3

You need to change the code you're using from

<div class="post-meta">
    <p><?php the_date(); ?> | <?php the_tags('tags:', ', ', '<br />'); ?> | <?php comments_number( $zero, $one, $more ); ?> comments</p>
    <?php comments_template(); ?>
</div><!-- end post-meta -->

to

<div class="post-meta">
    <p><?php the_date(); ?> | <?php the_tags('tags:', ', ', '<br />'); ?> | <?php comments_number( 'no responses', 'one response', '% responses' ); ?> comments</p>
    <?php comments_template(); ?>
</div><!-- end post-meta -->
1

you need to replace $zero, $one, and $more with your own code; read the example in the Codex: http://codex.wordpress.org/Function_Reference/comments_number#Examples

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.