• I’m using the following code in a function called by my sidebar:


    $posts = get_posts('category='.$cat.'&order=DESC&orderby=post_date');
    foreach ($posts as $post) :
    start_wp();
    // does a bunch of stuff
    endforeach;

    When I copy the code directly into the sidebar it works fine. When it’s embedded within the function, calls like the_date() and the_title() return my most recent posts (rather than those called for by the get_posts above). $post->ID gets me the ids I want, so I know there’s nothing wrong with get_posts. Anyone know what’s going on?

  • The topic ‘get_posts isn’t working right’ is closed to new replies.