Support » Fixing WordPress » Display comment count next to posts?

  • Hi,

    I’d like to add another column to the page here which displays the comment count of each of the posts (guitar tabs) listed there.

    Basically I just want add a new column header that says “Comments” (next to “Title, Rating”, “Views” and “Notes”) and then next to each tab, it will say “0” or “1” or “5” etc… or however many comments are on that guitar tab/wordpress post.

    I found a wordpress function called “get_comments_number” that I think will do this, but I can’t get it to work.

    Here is the code I tried:

    <?php $commentscount = get_comments_number(278); echo $commentscount; ?>

    With “278” being the post ID… and I was going to change that post ID to each different unique post ID, but I couldn’t get it to work.

    So my question is:

    Is this the right function I should be using? If so, what is wrong with my code? I feel like it’s close, I probably just need to change 1 little thing. Am I not able to put this php code inside a wordpress page or something maybe?

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display comment count next to posts?’ is closed to new replies.