[wp-trac] [WordPress Trac] #24264: Post Formats - Gallery Format: the_remaining_content still contains the gallery
WordPress Trac
noreply at wordpress.org
Sat May 4 20:15:32 UTC 2013
#24264: Post Formats - Gallery Format: the_remaining_content still contains the
gallery
--------------------------+-----------------------------
Reporter: Frank Klein | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Post Formats | Version: trunk
Severity: normal | Keywords:
--------------------------+-----------------------------
If you use the_post_format_gallery() along with the_remaining_content(),
the gallery will be displayed twice.
As far as I see, the only way to output a gallery separately from the rest
of the post content is to use get_content_galleries():
{{{
$post_content = get_the_content();
$gallery = get_content_galleries( $post_content, true, true, 0 );
echo $gallery[0];
echo apply_filters( 'the_content', $post_content );
}}}
This differs from the implementation for audio, video and images, as
the_remaining_content() strips the media from the post content before
display. the_remaining_content() should do the same with galleries.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/24264>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list