[wp-trac] [WordPress Trac] #19572: switch_to_post() stack implementation (similar to switch_to_blog())
WordPress Trac
wp-trac at lists.automattic.com
Thu Dec 15 22:40:36 UTC 2011
#19572: switch_to_post() stack implementation (similar to switch_to_blog())
-------------------------+------------------------------
Reporter: alexkingorg | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.3
Severity: normal | Resolution:
Keywords: has-patch |
-------------------------+------------------------------
Comment (by scribu):
That's just the thing. You wouldn't need to use the template tags. They
would be simple wrappers for the global. Think {{{is_single()}}} and
{{{$wp_query->is_single()}}}.
You don't need switch_to_post() when you have access to all the posts at
the same time:
{{{
$post_a = get_post( 1 );
$post_b = get_post( 2 );
$post_a->the_content();
$post_b->the_content();
}}}
But, since some of the filters on these template tags, such as
'the_content', do not pass the post id as a parameter, it's not that easy.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19572#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list