Call is helpful for calling a function that takes no arguments. This is needed as filters always take at least an argument. Use the call shortcode with the function's name as the first argument and any number of arguments to pass to the function afterward.
Syntax
The syntax for the 'call' Dynamic Shortcode is
{call:function_name args}
function_name
represents the PHP function you wish to executeargs
is optional and consists of one or more arguments passed to the function.For example
{call:function_name arg1 arg2}
Examples
Simple Function Call
{call:my_custom_function}
This example executes the
my_custom_function
PHP function.Function Call with Arguments
{call:calculate_sum 5 10}
Here,
calculate_sum
function is called with arguments5
and10
.Nested Function Call
{call:my_function {acf:field}}
Demonstrates nesting another shortcode within the
call
shortcode, wheremy_function
is executed with the result of the shortcode.
Special Privileges
The Call Dynamic Shortcode is available only inside Power Shortcodes.
Notes
Instead of a function name, you can use a callable object returned from another shortcode.