Randomization

Random Number

This simplest randomizing shortcode is the ability to simply output random numbers. Choose a minimum, choose a maximum and get your result. For example, here will show a random number from 1 to 20: 2

[random_number min="1" max="20"]

Random Values

After random numbers, the next important thing is random values. You create a list of values and choose to output one (or any number or them) in a random order. For example the following is a random selection from a list of shapes: oval

[random_value]square, circle, triangle, rectangle, oval, trapezoid[/random_value]

Random List

Just outputting random values everywhere isn’t enough. Sometimes you need to randomize the orders of things, and then use the values in random order in multiple places. For that we have the random lists. In this examples we’ll put a list of colors in random order:

Color One: red
Color Two: blue
Color Three: orange
Color Four: green
Color Five: purple
Color Five: yellow

[random_list]blue, green, red, orange, yellow, purple[/random_list]
Color One: [random_list_value num="1"]
Color Two: [random_list_value num="2"]
Color Three: [random_list_value num="3"]
Color Four: [random_list_value num="4"]
Color Five: [random_list_value num="5"]
Color Five: [random_list_value num="6"]

Random Content

Last but not least is the most powerful of them all, random sets of content (which includes containing other shortcode content). This allows you to not only choose a random bit of content to show, but also to randomize the order of sets of content as well. For example, here’s an example of an accordion with it’s values in random order:

Orange

Lorem ipsum sit amet dolor. Lorem ipsum sit amet dolor. Lorem ipsum sit amet dolor. Lorem ipsum sit amet dolor.

Blue

Lorem ipsum sit amet dolor. Lorem ipsum sit amet dolor. Lorem ipsum sit amet dolor. Lorem ipsum sit amet dolor.

Purple

Lorem ipsum sit amet dolor. Lorem ipsum sit amet dolor. Lorem ipsum sit amet dolor. Lorem ipsum sit amet dolor.

Green

Lorem ipsum sit amet dolor. Lorem ipsum sit amet dolor. Lorem ipsum sit amet dolor. Lorem ipsum sit amet dolor.

[accordion]
[random_content_set amount="4"]
[random_content][accordion_item title="Orange"]Lorem ipsum...[/accordion_item][/random_content]
[random_content][accordion_item title="Blue"]Lorem ipsum...[/accordion_item][/random_content]
[random_content][accordion_item title="Green"]Lorem ipsum...[/accordion_item][/random_content]
[random_content][accordion_item title="Purple"]Lorem ipsum...[/accordion_item][/random_content]
[/random_content_set]
[/accordion]
FacebookYouTube