The oik shortcode help often displays some complex syntax. How am I supposed to interpret it so that I can work out what I need to use?
The general form of a shortcode is a left square bracket
[ immediately followed by the
shortcode name, followed by some parameters followed by a right square bracket
Shortcodes which work work on embedded content ( such as [bw_css] ) are then followed by the shortcode content then the shortcode closing tag, which is similar to the opening tag but has a slash
/ after the left square bracket
Let’s take a look at an example for the bw_telephone shortcode.
Help for shortcode: [bw_telephone]
Telephone number (block)
prefix="Tel| string - Prefix string"
sep=": | string - Separator string"
alt="| 1 - Use alternative value"
number="| number - Number override"
tag="div| tag - enclosing HTML tag"
class="| class names - CSS class names"
link="| n| y| t| s| other: - tel: or sms: link"
index="telephone| field - oik options field to use"]
oik generated example.
The syntax shows the parameters of the form
parameter_name=default | alternative | another - short explanation
Before the equals sign is the parameter name. After the equals sign is the default value that will be used if you don’t specify the parameter followed by a set of alternative values you may use, separated by vertical bars. Spaces are there to allow wrapping of the syntax when there are a lot of acceptable alternatives.
Sometimes the values are free form so are shown in italics. Some parameters accept multiple values, with each value separated by a comma.
After the possible values is a short explanation of the parameter.
There are also shortcodes which assume certain parameter values based on their position after the shortcode. Some shortcodes use multiple parameter names for the same thing.
He we see that the default values for the bw_telephone shortcode are:
|prefix||Tel||The prefix text appearing before the separator|
|sep||:||the separator between the prefix and the telephone number|
|tag||div||the tag used to surround the expanded shortcode|
|index||telephone||the name of the options field used to obtain the telephone number|
So when the shortcode is used without any parameters then it uses the defaults.
For more advanced shortcodes which query the database, such as bw_posts and pw_pages, then the parameters can be far more complex, and require a certain understanding of the ways you can query posts using the WordPress functions. The oik shortcodes expose many of the parameters that you can pass to the WordPress functions.