Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#24264 closed defect (bug) (invalid)

Post Formats - Gallery Format: the_remaining_content still contains the gallery

Reported by: Frank Klein Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.6
Component: Post Formats Keywords: has-patch dev-feedback
Focuses: Cc:


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.

Attachments (1)

24264.diff (1.9 KB) - added by kovshenin 8 years ago.

Download all attachments as: .zip

Change History (5)

8 years ago

#1 @kovshenin
8 years ago

  • Keywords has-patch dev-feedback added
  • Milestone changed from Awaiting Review to 3.6

24264.diff should do the trick. I'm not sure why there wasn't a function for that in the first place, probably because it's slightly redundant, unlike get_the_post_format_image which does much more than get_content_image, get_attached_image, etc.

#2 @Frank Klein
8 years ago

Thanks Konstantin, the patch indeed does the trick. Everything is working correctly now.

#3 @wonderboymusic
8 years ago

  • Milestone 3.6 deleted
  • Resolution set to invalid
  • Status changed from new to closed

RIP the_remaining_content()

Note: See TracTickets for help on using tickets.