I needed to create a calendar section on a WP site. “post_status=future” doesn’t work properly (only a logged in user can see the future posts) so I found a plugin that changes the post status to “published” and used the following code to skip the old posts:
<?php query_posts('cat=5&showposts=10&order_by=date&order=ASC'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); if(strtotime($post->post_date) < time()) continue; ?>
I thought this worked great, but I came across a problem. If I have 10 or more posts older than today’s date, it’ll query those 10 posts, then skip them and not display anything.
Is there any way to either query posts after a certain date, or skip posts without adding to the counter?
- The topic ‘Problem skipping posts in a Loop’ is closed to new replies.