Forums

How to: Check if a post has comments as a condition (3 posts)

  1. Rongo
    Member
    Posted 3 months ago #

    Just curious if it's possible to do the following:

    Check if IS_SINGLE && comments > 0

    I am looking to make my sidebar dynamically include content according to the presence of comments, and do nothing if no comments exist yet.

    Any assistance would be be appreciated.

  2. Otto42
    Moderator
    Posted 3 months ago #

    Not unless you know the current post ID at that point in the code.

    if (get_comment_count(POST_ID) > 0) ...

  3. Rongo
    Member
    Posted 3 months ago #

    Ok, thanks Otto for the quick response.

Reply

You must log in to post.

About this Topic