Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to write PHP script that If forum doesn’t have content than do something ?


  • wpman
    Participant

    @iwpman

    Hi,
    I know <?php bbp_forum_content(); ?> will display forum content, but I don’t know how to write ” If forum doesn’t have content than do something” ? I try this script but it doesn’t work.

    <?php if(empty(bbp_forum_content()){echo "yes";} ?>
    
Viewing 4 replies - 1 through 4 (of 4 total)

  • Robkk
    Moderator

    @robkk

    This works when I tested it.

    <?php if ( $forum->post_content=="" ) { echo "yes";};?>


    wpman
    Participant

    @iwpman

    @robkk
    sorry,I think I wasn’t explain clearly.I want it ” If forum doesn’t has description then do something” in content-single-forum.php and display below breadcrumb. I try to run your script but it doesn’t work, no matter forum has or not it always echo “yes”.


    Robkk
    Moderator

    @robkk

    Oh this worked, not the other one. I tried it to see if it would do anything and forgot to change it back.

    <?php if ( $post->post_content=="" ) { echo "yes";};?>


    wpman
    Participant

    @iwpman

    Thank you for helping me. It worked !

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar