[wp-trac] [WordPress Trac] #29379: Add a hook to filter gallery classes
WordPress Trac
noreply at wordpress.org
Tue Aug 26 15:35:46 UTC 2014
#29379: Add a hook to filter gallery classes
-------------------------+-----------------------------
Reporter: grosbouff | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Gallery | Version: 3.9.2
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
Hi, it would be really great to be allowed to filter the gallery classes.
Here's what I suggest :
instead of :
{{{
$size_class = sanitize_html_class( $atts['size'] );
$gallery_div = "<div id='$selector' class='gallery galleryid-{$id}
gallery-columns-{$columns} gallery-size-{$size_class}'>";
}}}
rather use
{{{
$classes_str = null;
$classes = array(
'gallery',
'galleryid-'.$id,
'gallery-columns-'.$columns,
'gallery-size-'.sanitize_html_class( $atts['size'] )
);
$classes = apply_filters('gallery_classes',$classes,$attr);
if (!empty($classes)){
$classes = array_filter($classes);
$classes_str = " class='".implode(' ',$classes)."'";
}
$size_class = sanitize_html_class( $atts['size'] );
$gallery_div = "<div id='$selector' $classes_str>";
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29379>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list