Forums

Check to see if there is content (3 posts)

  1. desmondo
    Member
    Posted 4 years ago #

    Hi all,

    I've been scouring and I can't find the answer. I want check whether a post has anything in the content field and if so; link to it using the title.

    If there is no content in the post, I don't want to display the title as a link.

    It may be worth mentioning, I could have content in the optional excerpt, but not the content area sometimes, then I still don't want it to link to it.

    I've found an option here to check for the excerpt, but want to use this for the content.
    http://codex.wordpress.org/Conditional_Tags#Has_An_Excerpt

    Cheers

  2. Robinj
    Member
    Posted 4 years ago #

    It's something of a guess but
    !empty($post->post_content) might just work?

  3. desmondo
    Member
    Posted 4 years ago #

    Funnily enough, that does work. I never thought it would be that easy!

    Thanks for your help.

Topic Closed

This topic has been closed to new replies.

About this Topic