Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#5914 closed enhancement (fixed)

Positional attributes for shortcodes

Reported by: tellyworth's profile tellyworth Owned by:
Milestone: 2.5 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: Cc:


The shortcode API introduced with the gallery feature supports attributes like this:

[mytag foo=1 bar="baz"]

This patch adds support for positional attributes like this:

[mytag foo bar]

Positional attributes are included in the $atts array with numeric keys. It's possible to use quotes for attributes that contain spaces, and to mix positional and named attributes:

[mytag "foo bar" baz="bing" asdf]

This would produce the $atts array( 0 => 'foo bar', 'baz' => 'bing', 1 => 'asdf').

Unit tests are here:

Attachments (1)

shortcode-positional-atts-r6855.patch (1005 bytes) - added by tellyworth 15 years ago.

Download all attachments as: .zip

Change History (2)

#1 @ryan
15 years ago

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

(In [6911]) Support positional attributes in shortcodes. Props tellyworth. fixes #5914

Note: See TracTickets for help on using tickets.