0

I want to display the number of comments on a post using the template tag

            <?php comments_number( $zero, $one, $more ); ?>

However, for some reason this tag does nothing and it is not printed to the page. You can view an example of what I mean at http://blog.diginomics.com/bitcoins-innate-regulation/

Here is the full snippet of code for the 3 template tags: author, category, and comment:

                    <div class="post-info">
                    <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" class="post-item">
                        <i class="fa fa-user"></i>
                        <?php the_author(); ?>
                    </a>

                    <a href="<?php get_category_link( $category_id ); ?>" class="post-item">
                        <i class="fa fa-tags"></i>
                        <?php the_category( '&bull;' ); ?>
                    </a>                            

                    <a href="<?php comments_link(); ?>" class="post-item">
                        <i class="fa fa-comments"></i>
                        <?php comments_number( $zero, $one, $more ); ?>
                    </a>
                </div>

Why are the comment numbers not showing, and as a side question, why is the category split into 2 sections and not styling as it should?

  • The below 2 answers worked well. Thank you guys. I am also wondering why my category tag is separated like it is and why is it not styling like the other tags? – Travis Patron Sep 7 '14 at 18:44
-1

use it for comment number <?php comments_number( 'no responses', 'one response', '% responses' ); ?>

0

You will have to use this function in loop.

"Displays the total number of comments, Trackbacks, and Pingbacks for the current post. This tag must be within The Loop."

And also you will need to use this.

<?php comments_number( '0', '1', '%' ); ?>

Replace it with yours <?php comments_number( $zero, $one, $more ); ?>

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.