Skip to main content
Array - Dynamic Shortcodes
Updated over 6 months ago

With the array shortcode you can build a static array to pass to other Shortcodes.

To use it, pass the elements of the array as arguments to the shortcode,

{array: 1 2 3} 

will return the array

[1,2,3]

You can also use keyarg for associative arrays:

{array:@one=1 two=2 three=3} 

will result in the array

['one' => 1, 'two' => 2, 'three' => 3]

There are many cases where this might be useful, but the most simple example of this is in combination with the Loop Shortcode, so that you can repeat a template many times for each element in a static list.

{loop: 
{array: 27 109 356}
[{post:title}]
@sep=', '
}

will print the title of the 3 posts with ID 27, 109 and 356, each separated by comma.

Did this answer your question?