Forum Replies Created

Viewing 1 replies (of 1 total)
  • I’ve used this code in a sidebar, and am getting odd results. While I’m getting an li entry for each post in the category I’ve chosen, the title and link are for the most recent post on the front page. It seems like the setup_postdata isn’t taking the variable defined in the foreach, instead getting the other post. Thoughts?

    Here’s the code:

    <ul><li><h2>IE Missions</h2>
    <ul>
    <?php
    $mission_posts = get_posts('category=6&numberposts=-1'); foreach($mission_posts as $mypost) : setup_postdata($mypost);
    ?>
    <li><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permalink to <?php the_title(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>
    </ul>
    </li></ul>
Viewing 1 replies (of 1 total)