Support » Everything else WordPress » Add Comment Count to About Page

  • hello,
    i have enabled comments on my “about” page and would like to include a counter as well. for each post on my main page there is a comment counter next to the post theme and i would like to have my “about” page set up likewise. i looked thru archives and did not see this addressed. i originally posted this the evening of friday 21nov but it mysteriously vanished over night! thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • is there no one who is willing to help? if this is the wrong forum or it simply cannot be done please advise. thank you

    hey man, just came across your post, try using the following code within the loop.

    <? $comment_count = $post->comment_count; ?>

    thanks Wiz for answering, to be honest i had given up on any help! one question, what do you mean by “within the loop?” as you can see i am a neophyte. thanks again.

    No problem man, just remember to be patient when you post on here. Hundreds of people are posting questions every day, so it’s very easy for one to get lost in the mix. Eventually, someone will find it!

    To answer your question, the loop is what retrieves post or page information.

    The loop starts with:
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    and ends with:

    <?php endwhile; else: ?>
    <p><?php _e(‘Sorry, no posts matched your criteria.’); ?></p>
    <?php endif; ?>

    1) Copy page.php template from your template directory. At the very top of the file, add this to the very first line:

    Template Name: About Page

    After the line with the_post() and before the first endwhile, add this line:

    echo $post->comment_count;

    Save the file as about.php and upload it to your current template directory. Login to your WordPress admin page and go to manage pages to select your about page. This will bring up the page editor. You will have your title and page content. Well below that, you will see a section saying “Page Template”. Click the dropdown box and select About Page. Now your about page will load the about.php file instead of the standard page.php

    You can read about the loop here:

    Hope this helps.

    – The Wiz

    many thanks again Wiz for your help and advice! i try to be patient i do realize that there are an enormous amount of people looking for help. i will try your suggestion first chance i get.
    also thanks to you “jbjweb” for your input. i will certainly read it, i need all the help i can get!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add Comment Count to About Page’ is closed to new replies.