Forums

[resolved] Return Comments Number to use in If statement (5 posts)

  1. obeattie
    Member
    Posted 3 years ago #

    Hey Guys,

    I was just wondering if anyone knew how to return the number of comments for use in an if statement - something like:

    if(comments_number() != '0') {

    Is that possible?

    Any help greatly appreciated,

    Many Thanks,
    Oliver

  2. theiconoclast31
    Member
    Posted 3 years ago #

    If it isn't possible using template tags alone, you could certainly use this:
    http://txfx.net/code/wordpress/ping-track-comment-count/

  3. obeattie
    Member
    Posted 3 years ago #

    Thanks.. but that says that it echoes the counts

  4. theiconoclast31
    Member
    Posted 3 years ago #

    There are two functions you can use: get_comment_type_count() (which returns the value) and comment_type_count() (which echoes the value).

    Shouldn't that first function work?

  5. obeattie
    Member
    Posted 3 years ago #

    Cheers!

Topic Closed

This topic has been closed to new replies.

About this Topic