Problems using two loops
-
Hi There,
I have created my own theme and everything is running okay.
I want to have a list of the top 5 latest news items visible on every page of the site, this includes post & page.php pages.
This is the basic code of my list:
<ul> <?php while (have_posts()): the_post(); ?> <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li> <?php endwhile; ?> <?php rewind_posts(); ?> </ul>
This is run before the main wordpress loop.
I am finding that when I visit a page (i.e. using the page.php file) this list shows just the title of the current page, not the latest blog posts.
I think this is because my code is reading from whatever is in the post array which is changing for each page. I am not, however, sure how I can solve this isse so that the list is the same on every page independent of any other loops.
Any help on this one would be much appreciated!
– Fred
- The topic ‘Problems using two loops’ is closed to new replies.