Loop in sidebar
-
I’m running WP 2.3.2. I have 2 questions on this code in my sidebar:
<?php rewind_posts(); ?> <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?> <?php if (in_category(11)) { ?> <div class="sidenotes"> <?php echo $post->post_excerpt ?> <?php the_content(); ?> </div> <?php } ?> <?php endforeach; else: ?> <?php _e('Sorry, no posts matched your criteria.'); ?> <?php endif; ?>
I have 1 post in category 11. Today (1/6/08 for me), if the date on that post is 11/29/07, that code displays no post content. If I change the date (and only the date) to 11/30/07, the content displays just fine. I’ve only noticed this behavior since I upgraded to 2.3.2, but I can’t swear to that.
Why is that code affected by the post date?
Secondly, with the right date, that code works as expected but only on the home page. I have a number of other pages (say a Videos page). If I surf to the Videos page, that code doesn’t output the post content, even though I have rewind_posts() at the top.
In both the date case and surfing off the home page case, I never get the “Sorry, no posts…” message.
Is there another problem with my loop that I’m missing?
Thanks in advance for any pointers.
- The topic ‘Loop in sidebar’ is closed to new replies.