WordPress.org

Ready to get started?Download WordPress

Forums

Comments link in title (5 posts)

  1. rickstrling
    Member
    Posted 7 years ago #

    I've got comments working on my posts, single page posts and selected pages (using a cloned and modified template).

    I also want it to display the number of comments for each post or page, in the title area.

    In each post on the front page I'm using the following:

    <div class="post_comments">
    <?php comments_popup_link(__('No comments'), __('Comments (1)'), __('Comments (%)')); ?>
    </div>

    Which displays the number of comments I have for a post. Works perfectly.

    You can see here: http://www.rsart.co.uk

    I'm using the same code on my singlepost and pages, but this call isn't working (I've resorted to using   for now to stop the css breaking)

    The comments box does work however, I just can't display the No comments/ Comments(X) in the title area.

    I have got <?php comments_popup_script(); ?> in the header.

    Any ideas?

  2. rickstrling
    Member
    Posted 7 years ago #

    Actually, I've just taken <?php comments_popup_script(); ?> out of the header, as I dont want the popup window.

    Still no joy in getting the number of posted comments to dissplay on any page other than the index.

  3. RickStirling
    Member
    Posted 7 years ago #

    I've just upgraded to the latest version of WordPress (scary but quite simple - MAKE A FULL BACKUP!), jut in case it was a bug.

    Still no joy though

  4. ZMAng
    Member
    Posted 7 years ago #

    If memory serves me correctly, comments_popup_link() is supposed to work that way, i.e. show number of comments on index page, but not on single/permalink pages.

    For a template tag that works everywhere, I believe you have to use comments_number().

  5. RickStirling
    Member
    Posted 7 years ago #

    Thank you!

    I wrapped that in an anchor, linked to "#respond", and it's just what I needed.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.