Forums

Show number of comments on homepage (3 posts)

  1. Sadmir
    Member
    Posted 4 years ago #

    Hi,

    I'm sure this question go asked before, and I found some answers too, but my php skills are still weak and I didn't get it to work.

    My site is running WordPress Version 2.5.1, and on my homepage I would like to display the total number of comments posted, and as someone posts a comment the number of comments should change on the homepage too.

    something like this

    <h2>
    <p>Over 144 comments collected</p>
    </h2>

    The "144" is the number of comments.

    Pleas keep it simple, because I just started to learn php.

    To get an better idea what I'm trying to do just go to http://www.NOTRogers.com

    Thank you for your help

  2. Sadmir
    Member
    Posted 4 years ago #

    anybody please...

  3. chrismou
    Member
    Posted 4 years ago #

    Use something like this:

    <?php comments_popup_link('0 comments', '1 comment', '% comments', 'commentslink', 'Comments Closed'); ?>

    if you insert this into your post page, within The Loop, it will show something like:

    0 comments
    or
    1 comment
    or
    50 comments
    or
    comments closed

    .. depending on the situation. The text can be customised by changing the text within the example I gave above.

    For more info, check this out:

    http://codex.wordpress.org/Template_Tags/comments_popup_link

    Hope this helps!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags