Don't want box if no posts

Viewing 1 post (of 1 total)
  • #2216
    SpaceGhost79
    Participant

    http://wnmufm.org

    Is there a way (code) to make it so if you don’t have any posts for a particular section on your main page, the box won’t show up and jump bump up the stuff below it?

    For instance, if you scroll down a little bit to the “Laughing Whitefish” section I have. This section displays the latest post in the category named “Books.” If I remove the post, so there are no posts in that category, that section would still display “No entries found. There are no entries in this blog,” in its place. Is there a way to make it so if there no posts in that category the whole section wouldn’t appear and whatever’s below it (in this case the Program Highlights section) would just move up below the news section? Here’s the code right now…

    [code] <div id=”latest”>
    <h3><?php _e(‘Laughing Whitefish’,’cover-wp’) ?></h3>
    <?php query_posts(“caller_get_posts=1&showposts=3&category_name=”.get_option(‘cover_wp_photos_cat’, ‘Books’)); $i = 1; ?>
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <div class=”the_content”>
    <?php the_content(‘Read entire article »’); ?>
    </div><!– /the_content –>
    <?php endwhile; ?>
    <?php wp_reset_query(); ?>
    <?php else: ?>
    <h2 class=”center”><?php _e(‘No Entries Found’,’cover-wp’) ?></h2>
    <p class=”center”><?php _e(‘There are no entries in this blog.’,’cover-wp’) ?></p>
    <?php endif; ?>
    </div>[/code]

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.