-
Notifications
You must be signed in to change notification settings - Fork 2
Shortcodes syntax
Go back: Shortcodes
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]
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.
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]