Opened 8 years ago
Closed 7 years ago
#37329 closed enhancement (fixed)
Pass all attributes in wp_video_shortcode_class, wp_audio_shortcode_class filters
Reported by: | sakibmoon | Owned by: | sathyapulse |
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 3.6 |
Component: | Media | Keywords: | good-first-bug has-patch commit |
Focuses: | Cc: |
Description
Take a look at the following line of code: https://core.trac.wordpress.org/browser/tags/4.5.3/src/wp-includes/media.php#L2502
$atts['class'] = apply_filters( 'wp_video_shortcode_class', $atts['class'] );
Using this filter we can add/remove class to video container. But I need facility where I can add custom class based on other attribute like video src.
Can we pass all the attributes instead of just the existing classes?
Attachments (2)
Change History (11)
This ticket was mentioned in Slack in #core-media by desrosj. View the logs.
7 years ago
#3
@
7 years ago
- Keywords needs-patch good-first-bug added; has-patch removed
- Version changed from 4.5.3 to 3.6
#4
@
7 years ago
Hello @desrosj,
I have prepared the patch for adding the additional attributes parameter to the filter. Could you please check it?
https://core.trac.wordpress.org/attachment/ticket/37329/37329.diff
#6
@
7 years ago
- Milestone changed from Awaiting Review to 4.9
The same should be done for wp_audio_shortcode_class
for consistency.
#7
@
7 years ago
@desrosj @SergeyBiryukov I have created a new patch file which includes both the Audio and Video shortcode filter changes.
#8
@
7 years ago
- Focuses ui removed
- Keywords commit added
- Owner set to sathyapulse
- Status changed from new to assigned
- Summary changed from Need all the attributes in wp_video_shortcode_class filter to Pass all attributes in wp_video_shortcode_class, wp_audio_shortcode_class filters
Assigning the ticket to mark the good-first-bug as "claimed".
@sathyapulse This looks good to me and is a good addition. Marking commit
so a committer can check it out.
Hi @sakibmoon! This is a good request. Adding a second parameter to the filter where
$atts
is passed would be fine. Are you interested in supplying a patch?