Skip to main content
Array - Dynamic Shortcodes
Updated over a week 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


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.

{array: 27 109 356}
@sep=', '

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

Did this answer your question?