Make WordPress Core

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's profile sakibmoon Owned by: sathyapulse's profile sathyapulse
Milestone: 4.9 Priority: normal
Severity: normal Version: 3.6
Component: Media Keywords: good-first-bug has-patch commit
Focuses: Cc:


Take a look at the following line of code:

$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)

37329.diff (599 bytes) - added by sathyapulse 7 years ago.
37329.1.diff (1017 bytes) - added by sathyapulse 7 years ago.

Download all attachments as: .zip

Change History (11)

#1 @sakibmoon
8 years ago

  • Keywords has-patch added
  • Type changed from feature request to enhancement

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.

7 years ago

#3 @desrosj
7 years ago

  • Keywords needs-patch good-first-bug added; has-patch removed
  • Version changed from 4.5.3 to 3.6

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?

7 years ago

#4 @sathyapulse
7 years ago

Hello @desrosj,

I have prepared the patch for adding the additional attributes parameter to the filter. Could you please check it?

Version 0, edited 7 years ago by sathyapulse (next)

#5 @sathyapulse
7 years ago

  • Keywords has-patch added; needs-patch removed

#6 @SergeyBiryukov
7 years ago

  • Milestone changed from Awaiting Review to 4.9

The same should be done for wp_audio_shortcode_class for consistency.

7 years ago

#7 @sathyapulse
7 years ago

@desrosj @SergeyBiryukov I have created a new patch file which includes both the Audio and Video shortcode filter changes.

#8 @desrosj
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.

#9 @SergeyBiryukov
7 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 41234:

Media: Pass shortcode attributes to wp_audio_shortcode_class and wp_video_shortcode_class filters.

Props sathyapulse.
Fixes #37329.

Note: See TracTickets for help on using tickets.