• Resolved FantasyPC

    (@fantasypc)


    Hi Everyone, I have an image slider on one of my websitehere What I want to do is make the homepage show a <div> box if there is text in the post content. If there is no text in the content I don’t want it to display anything. I have tried the following code but does not work.

    <?php if(trim($post->post_content) != '' ) {the_content();
    } else if ($post->comment_count != 0) {
    echo '<div="slide-1-desc"><h1> <?php the_title();?> </h1> <?php the_content("read more");?></div>';
    } else {
    echo "&nbsp;";
    } ?>

    If you need the entire php of homepage let me know I can post it. thank you in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Unless I am mistaken, the logic shown in your code does not match what you said you want to do. Here is how I interpret the code:

    IF there is any post content
       Show the content
    ELSE IF there are any comments
       Show the div with the slider
    ELSE
       Show a space
    END IF

    So, if there is any content, you will show only the content.

    If there is no content, but there are comments, show the slider.

    Is that what you want?

    Thread Starter FantasyPC

    (@fantasypc)

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Problem with home page’ is closed to new replies.