Make WordPress Core

Opened 17 years ago

Closed 17 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:

Description

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:

http://svn.automattic.com/wordpress-tests/wp-testcase/test_shortcode.php

Attachments (1)

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

Download all attachments as: .zip

Change History (2)

#1 @ryan
17 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.