[wp-trac] [WordPress Trac] #12976: Add get_post_content()/get_post_excerpt() and save_postdata()/restore_postdata() for support.
WordPress Trac
wp-trac at lists.automattic.com
Mon Apr 12 16:05:25 UTC 2010
#12976: Add get_post_content()/get_post_excerpt() and
save_postdata()/restore_postdata() for support.
--------------------------+-------------------------------------------------
Reporter: mikeschinkel | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Unassigned
Component: Post Types | Version: 3.0
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
Currently the {{{get_the_content()}}} and {{{get_the_excerpt()}}}
functions return the values from the loop but do not allow a Post object
to be passed. These functions in the patch ({{{get_post_content()}}} and
{{{get_post_excerpt()}}}) save and then restore the global variables
assigned by {{{setup_postdata()}}} so that {{{get_the_content()}}} can be
called for a specific post.
The functions to save and restore the postdata are {{{save_postdata()}}}
and {{{restore_postdata()}}} respectively, and they simply capture the
values of the global variables set in {{{setup_postdata()}}} into an array
and then restore them back from the array.
This is the first of a broader patch I hope to supply with functions for
{{{get_post_*()}}} and {{{the_post_*()}}} that would each receive as their
first parameter a Post object/post ID/post array and as a second an array
of {{{$args}}} so that robust code can be written related to posts and so
that there will be a set of functions for this with a ''consistent'' set
of parameters.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12976>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list