[wp-trac] [WordPress Trac] #21569: Filter gallery styles with access to $attr
WordPress Trac
noreply at wordpress.org
Fri Feb 15 22:30:43 UTC 2013
#21569: Filter gallery styles with access to $attr
-------------------------+------------------
Reporter: betzster | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.6
Component: Media | Version: 3.5
Severity: normal | Resolution:
Keywords: has-patch |
-------------------------+------------------
Changes (by drywallbmb):
* keywords: => has-patch
Comment:
The problem is that the gallery_style filter only runs on the string
before it's actually been populated with items. Thus, you can't use to,
for example, use a str_replace to get rid of all the <br> elements,
because they haven't been tacked onto $output yet.
And yes, sorry for the ambiguity, I meant the splitter <br>'s — in the
loop they're being output with double quotes in the HTML and after the
loop the final <br> element is being output with single quotes around the
style attribute.
For giggles (and/or clarity), I'm attaching my proposed patch, which
normalizes all HTML element attribute values generated by
gallery_shortcode() to be double-quoted, and adds the gallery_output
filter making it possible to filter the entire gallery's markup. As
mentioned, I'm rusty with SVN so apologies if the patch is borked.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21569#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list