#24264 closed defect (bug) (invalid)
Post Formats - Gallery Format: the_remaining_content still contains the gallery
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 3.6 |
| Component: | Post Formats | Keywords: | has-patch dev-feedback |
| Focuses: | Cc: |
Description
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)
Change History (5)
#1
@
13 years ago
- Keywords has-patch dev-feedback added
- Milestone changed from Awaiting Review to 3.6
#2
@
13 years ago
Thanks Konstantin, the patch indeed does the trick. Everything is working correctly now.
Note: See
TracTickets for help on using
tickets.
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_imagewhich does much more thanget_content_image,get_attached_image, etc.