Forums

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

  1. Rongo
    Member
    Posted 2 years 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. Otto
    Tech Ninja
    Posted 2 years 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 2 years ago #

    Ok, thanks Otto for the quick response.

Topic Closed

This topic has been closed to new replies.

About this Topic