Support » Themes and Templates » "Cutting up" the loop – future posts

  • Hi! I use the following code for displaying my future posts on top of my page.

    			$my_query = new        WP_Query('post_status=future&order=ASC&showposts=5');
    			if ($my_query->have_posts()) {
       			while ($my_query->have_posts()) : $my_query->the_post(); ?>
            		<div class="frame">
                                 <div class="left">
            		            Coming soon
            		    <div class="right">
                                        <div class="post">
                                                 Future post
    <?php endwhile; } ?>

    This means that the LEFT-DIV will repeat itself if I have 2 or more future posts. I can put the LEFT-DIV outside the loop, but then it will show even when there is no future posts.


    How can I make the LEFT-DIV only appear once if there are future posts, and make the POST-DIV repeat itself inside the RIGHT-DIV if there are more than one future post?

    Thanks in advance!


  • The topic ‘"Cutting up" the loop – future posts’ is closed to new replies.