• can someone explain why this code is breaking my page?

    <?php
    $post_id = 2348;
    $queried_post = get_post($post_id);
    $title = $queried_post->post_title; 
    
    if !emptyempty($queried_post->post_content)
    
    echo $queried_post->post_content
    
    else echo { ?>
    <div id="navigation"></div>
    <?php } ?>

    i want to display this certain post. But if theres nothing in the body of the post i want to not display it (because the post is styled with a border around it, so even if blank an empty box shows up) and show my navigation div instead. any thoughts?

Viewing 1 replies (of 1 total)
  • Thread Starter gmisen

    (@gmisen)

    woops just had a revelation and figured it out, nevermind

    <?php
    $post_id = 2348;
    $queried_post = get_post($post_id);
    $title = $queried_post->post_title; 
    
    if (empty($queried_post->post_content)) { ?>
    
    <div id="navigation"></div>
    <?php } else { ?>
    <div class="firstpost"><?php echo $queried_post->post_content ?></div>
    <?php } ?>
Viewing 1 replies (of 1 total)
  • The topic ‘conditional tag php if content is blank’ is closed to new replies.