WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 15 months ago

#24456 closed defect (bug) (fixed)

Add src attribute to embed shortcode

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

Description

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

See: http://make.wordpress.org/core/2013/05/29/post-formats-ui-is-exiting-core-will-live-as-a-plugin/

Attachments (3)

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

Download all attachments as: .zip

Change History (11)

comment:2 @wonderboymusic2 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="subtitles.srt" 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

@kovshenin2 years ago

comment:3 @kovshenin2 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 2 years ago by kovshenin (previous) (diff)

comment:4 @wonderboymusic2 years ago

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

comment:5 @nacin2 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.

@aaroncampbell2 years ago

comment:6 @aaroncampbell2 years ago

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

@wonderboymusic15 months ago

comment:7 @wonderboymusic15 months 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.

comment:8 @wonderboymusic15 months 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="https://www.youtube.com/watch?v=ZqD-LPOWIT0"]
[embed src="https://www.youtube.com/watch?v=ZqD-LPOWIT0"][/embed]

If you do:
[embed src="https://www.youtube.com/watch?v=ZqD-LPOWIT0"]http://any-other-url.com[/embed]

... "http://any-other-url.com" will be the URL that is parsed.

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

Note: See TracTickets for help on using tickets.