Opened 16 years ago
Closed 11 years ago
#14130 closed enhancement (wontfix)
Better gallery shortcode filter
| Reported by: | johnbillion | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Shortcodes | Version: | 3.0 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
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
@
14 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.
#10
@
11 years ago
- Resolution wontfix
- Status closed → 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
@
11 years ago
- Keywords has-patch removed
- Milestone Awaiting Review
- Resolution → wontfix
- Status reopened → 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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.