[Resolved] get_posts loop leaking on single page
Please bear with me, I barely know what I’m doing here.
I have the main loop open with
<?php if (have_posts()) : ?>–it opens at the top of my html page and closes at the bottom. Somewhere in the middle, I use get_posts to show the three most recent posts using:
<?php global $post;$myposts = get_posts('numberposts=3&order=DESC&orderby=date');foreach($myposts as $post): ?> <DIV STYLE="width:100%; border-bottom:1px solid #ffffff;"><DIV STYLE="padding:5px; padding-left:10px; padding-right:10px; border-bottom:1px solid #eaeaea;"><FONT CLASS="font4"><A HREF="<?php the_permalink(); ?>"><?php the_title(); ?></A></FONT></DIV></DIV> <?php endforeach; ?>
At the bottom of the page, I want to display the publish date of the main post–but I’m getting the publish date for the last of the recent three posts called by get_posts instead.
<?php the_time('j F Y'); ?>
Here’s an example page: http://www.jadedgamefans.com/ninja250blog/miscellany/digging-dirt/
The publish date 22 August 2009 is from post “Sur to Malibu, PART II: Malibu canyons” which is the last in the list of 3 “Latest articles.” The date should be 24 November 2008, which is the publish date for the article “Digging dirt.”
What am I doing wrong here?
- The topic ‘[Resolved] get_posts loop leaking on single page’ is closed to new replies.