Make WordPress Core

Opened 11 years ago

Closed 10 years ago

#24456 closed defect (bug) (fixed)

Add src attribute to embed shortcode

Reported by: aaroncampbell's profile aaroncampbell Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.0 Priority: normal
Severity: normal Version:
Component: Embeds Keywords: has-patch
Focuses: Cc:


The embed shortcode takes URL as its content, but a/v ones take an attribute — make both for both?


Attachments (3)

24456.diff (1.6 KB) - added by kovshenin 11 years ago.
24456.2.diff (398 bytes) - added by aaroncampbell 11 years ago.
24456.3.diff (442 bytes) - added by wonderboymusic 10 years ago.

Download all attachments as: .zip

Change History (11)

#2 @wonderboymusic
11 years ago

one caveat here - for video, if you want to add subtitles (which we don't support yet - MediaElement does), the body of the shortcode might be a good place to put it:

<track kind="subtitles" src="" srclang="en" />

Otherwise, HTML frags will have to be passed to the shortcode as attributes. Granted, one could filter 'wp_mediaelement_fallback', but that sounds super ghetto

11 years ago

#3 @kovshenin
11 years ago

24456.diff adds support for URL as the shortcode content for audio and video callbacks, as well as a src attribute to the embed shortcode callback. The src attribute (if not empty) has a higher priority in all three shortcodes.

Last edited 11 years ago by kovshenin (previous) (diff)

#4 @wonderboymusic
11 years ago

I am going to suggest not doing this - see my above comment about <video>, which can contain <track> in its body

#5 @nacin
11 years ago

  • Component changed from Media to Embeds
  • Milestone changed from 3.6 to Future Release
  • Summary changed from Make audio/video shortcodes consistent with embed to Add src attribute to embed shortcode

I agree with wonderboymusic, so does MarkJaquith per IRC.

In that case, maybe we can add 'src' to [embed].

Punting out of 3.6 as it's not a necessity.

#6 @aaroncampbell
11 years ago

24456.2.diff is just an update to the patch by kovshenin with only the src attribute for embed part

#7 @wonderboymusic
10 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 4.0

24456.3.diff is a refresh and only sets the URL from attribute if the body (where the URL typically resides) is empty.

#8 @wonderboymusic
10 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 28559:

Read the src attribute for the [embed] shortcode if the shortcode's body is empty.

These work:
[embed src=""]
[embed src=""][/embed]

If you do:
[embed src=""][/embed]

... "" will be the URL that is parsed.

Props kovshenin, aaroncampbell for making initial patches.
Fixes #24456.

Note: See TracTickets for help on using tickets.