• Scenario:
    -in the template but prior to the loop::
    $extraposts = get_posts(‘yadda1=x&yadda2=y…’);
    print_r($extraposts);
    -plenty of posts are there
    if $extraposts : foreach $extraposts as $post : start_wp();
    …<?=some_core_or_plugin_function_doesn’t_matter();?>…
    .
    .
    .
    endfor; endif;
    function some_core_or_plugin_function_doesn’t_matter() {
    print_r($post);
    -NOTHING
    print_r($extraposts);
    -NOTHING
    }
    I don’t get it. but this did work under 1.2

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter asknight

    (@asknight)

    b.t.w. forgot to mention:
    global $post, $extraposts;
    should have been included in the example above.

    Soooo, you’re problem is what exactly?

    Are you expecting $post and $extraposts to be something at the end there? Because I wouldn’t expect them to be.

    $post won’t be anything because it hasn’t been set yet. And for $extraposts, you’ve already looped through them, so you would be at the end position….

    -tg

    Thread Starter asknight

    (@asknight)

    Nooooo, the function is being called however many times in the foreach loop. I’d expect both $post and $extraposts to be happening.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘get_posts loop outside ‘the loop’ don’t see post objects’ is closed to new replies.