Skip to main content
Call - Dynamic Shortcodes
Updated over a week ago

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 execute

  • args is optional and consists of one or more arguments passed to the function.

    For example

    {call:function_name arg1 arg2}

Examples

  1. Simple Function Call

    {call:my_custom_function}

    This example executes the my_custom_function PHP function.

  2. Function Call with Arguments

    {call:calculate_sum 5 10} 

    Here, calculate_sum function is called with arguments 5 and 10.

  3. Nested Function Call

    {call:my_function {acf:field}} 

    Demonstrates nesting another shortcode within the call shortcode, where my_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.

Did this answer your question?