[wp-trac] [WordPress Trac] #24002: Improve get_the_post_format_media and get_the_post_format_image caching
WordPress Trac
noreply at wordpress.org
Tue Apr 9 11:28:53 UTC 2013
#24002: Improve get_the_post_format_media and get_the_post_format_image caching
-------------------------+--------------------------
Reporter: kovshenin | Type: defect (bug)
Status: new | Priority: normal
Milestone: 3.6 | Component: Post Formats
Version: trunk | Severity: normal
Keywords: needs-patch |
-------------------------+--------------------------
We need a better approach at caching the results of our
`get_the_post_format_media` and `_image` functions. Currently we're just
dumping the HTML into `$post->format_content` as a string, so calling:
{{{
$post = get_post( 8703 );
echo get_the_post_format_image( 'full', $post );
echo get_the_post_format_media( 'audio', $post );
echo get_the_post_format_media( 'video', $post );
}}}
Will output the image tag three times, even if 8703 is an audio, video or
quote post. We need to be smarter about how we cache things in structured
post formats, and take into account any arguments that are passed in, like
the image size for `get_the_post_format_image`:
{{{
$post = get_post( 8703 );
echo get_the_post_format_image( 'thumb', $post );
echo get_the_post_format_image( 'large', $post );
echo get_the_post_format_image( 'full', $post );
}}}
Will output three thumbs. Related: #23945.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/24002>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list