[wp-trac] [WordPress Trac] #29832: Add filter to final output of gallery_shortcode

WordPress Trac noreply at wordpress.org
Fri Jan 23 15:30:10 UTC 2015


#29832: Add filter to final output of gallery_shortcode
-------------------------+------------------------------
 Reporter:  dcrabill     |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Gallery      |     Version:  2.5
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  template
-------------------------+------------------------------

Comment (by caitrionad):

 +1 for being able to modify the innards of gallery_shortcode - I
 frequently find myself wanting to add a class to a gallery item while
 continuing to use the rest of the standard implementation.

 The solutions above were helpful in achieving that but I'd love if there
 were a cleaner way.

 BTW, re. using `wp_get_attachment_link` to modify a gallery item's link,
 there is a way to apply that solely to gallery attachment links:

 {{{
 add_filter(
     'post_gallery',
     function(){
 add_filter('wp_get_attachment_link','custom_modify_gallery_shortcode_link');
     }
 );
 }}}

 (found here: http://wordpress.stackexchange.com/questions/134811/add-
 gallery-id-to-rel-attribe-of-wp-get-attachment-link)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29832#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list