Skip to content

Shortcodes syntax

Damien Sorel edited this page Jan 21, 2015 · 1 revision

Go back: Shortcodes

Corpse

Two syntaxes are allowed:

  • [tag] and [tag/] for tags without content
  • [tag] content [/tag] for tags with content

The [tag/] form is particularly useful for tags that can be used both with and without content. For exemple the following content will be parsed incorrectly:

[tag]

[tag] content [/tag]

This can be corrected by using the self closing version of the tag:

[tag/]

[tag] content [/tag]

Attributes

Any form of tags accept attributes in two forms:

  • [tag attr] for attributes with no value
  • [tag attr=foo] for attributes with value

Attributes names can only contain letters A-Z (lower and upper case), numbers 0-9, underscores _ and hyphens -.

Attributes value can be quoted or double-quoted if needed (required if containing spaces).

Read Shortcodes callback to know how to use attributes in the shortcode callback.

Escaping

If you want to disable the parsing of a tag, for example to create an help page with both parsed and unparsed tags, you double the brackets.

[[tag attr=foo]]

Will simply render to:

[tag attr=foo]
Clone this wiki locally