Filters allows you to transform the Dynamic Shortcode output to get what you need.
The filters work as pipeline, they take a value they do something with it and then pass the result to the next filter or, if no more filters are present, as the final result of the shortcode. There can be arbitrarily many chained filters inside a shortcode.
Types of Filters
PHP Function - Pipe First (|)
The pipe first (symbol |), will pass the value coming from the left to the given function as the first argument, the other arguments given inside parentheses will be passed to the function after that. For example
{identity:"hello world"|strtoupper}
will be expanded to "HELLO WORLD!".Another example is:
{acf:myfield|my_function(arg1)}
The value of the field will be passed to the custom function together with arg1, if $myfield_value is the value of the ACF field, the function is called like this:my_function($my_field_value, "arg1")
PHP Function - Pipe Last (|-)
The pipe last (symbol |-, a pipe and minus) work like the pipe first filter, but the value coming from the left is always passed as the last argument.
For example
โ{identity:hello|-str_replace(e, a)}
will expand tohallo
.Array Access (||)
The access filter (symbol ||) is used for accessing value inside arrays. It can be used both with numeric and string keys. For example
{array:a b c||1}
will expand to b. And{array:@a=1 b=2 c=3||b}
will expand to2
.Property Access (|.)
It's used to access object in PHP object, it's the equivalent of PHP
$object->property
. If you have a shortcode that returns a PHP object you can use it like so:{post:my-object |. property_name}
This filter can only be used inside Power Shortcodes.