The let
Shortcode defines variables that will be valid only during the evaluation of its first argument. It can be useful if you need to use a value more than once. The variables are defined by assigning them to keyargs.
Simple Example
Here we are defining the variables greeting and name, and using them in the first argument.
{let: [{get:greeting} {get:name}!] @greeting='Hello' name='Joe'}
This will output
Hello Joe!
Real usage Example
{let:
[Valid From {date:$x '-2 days'} to {date:$x '+2 days'}]
@x={acf:mydate}
}
Here we are fetching the acf field mydate
only once and then using it twice to print a date range from two days before it to two days after it.