Opened 15 years ago
Closed 9 years ago
#14130 closed enhancement (wontfix)
Better gallery shortcode filter
Reported by: | johnbillion | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0 |
Component: | Shortcodes | Keywords: | |
Focuses: | Cc: |
Description
There's a filter inside gallery_shortcode()
which allows plugins to override the default gallery template ('post_gallery'), but it's called at the beginning of the function before we've fetched our gallery images. If a plugin uses this filter, it has to perform a lot of logic to determine the post gallery images.
We should add a second filter to gallery_shortcode()
after we've determined our gallery images, to make plugin authors' jobs easier.
Attachments (2)
Change History (15)
#8
@
12 years ago
- Keywords close added
No traction on this in 3 years. Suggest wontfix. Whatever method I used to get around this at the time must have worked fine.
#9
@
12 years ago
- Milestone Future Release deleted
- Resolution set to wontfix
- Status changed from new to closed
#10
@
9 years ago
- Resolution wontfix deleted
- Status changed from closed to reopened
Adding this filter will open up a lot of possibilities to modify the output without having to reinvent the wheel altogether. For instance, I need to make sure the captions are linked to the attachment page, while the images themselves link to the full-sized images so that visitors can click on any image to view them in any lightbox plugin that may have been activated, while still retain the ability to go to the attachments page by clicking the linked caption, and view any further details about the image and its custom fields etc. Such a filter will allow for that and other similar possibilities without having to create a new shortcode for the purpose.
#13
@
9 years ago
- Keywords has-patch removed
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from reopened to closed
The first approach seemed simple enough; add a filter after the attachments are pulled. Having said that, it only skips 29 lines of logic, 13 of which are setting up attribute defaults.
The new patch has several issues, but the big one is that it really doesn't address the original problem expressed in this ticket. Adding container and item classes that can be passed in and filtered doesn't help a plugin that needed to rewrite the logic for pulling attachments in order to short circuit the gallery logic.
@HQRaja You don't need to create a whole new shortcode, just use the existing post_gallery
filter. Find that filter in wp-includes/media.php, and look at the next 20-30 lines, as you may want to incorporate them into your code.
Due to the lack of interest and the ease of the work around, I'm going to go ahead and close this again.
Patch which adds a 'post_gallery_output' filter.
Similar filter to 'post_gallery' found on line 763 of same file, but we include a second parameter with our array of attachments.