Callback
This block type calls a custom function and renders its output.
- callback - callable function name;
- params - an array of function arguments;
- return - set to
true
if the function returns the result instead of echoing it.
The code below renders the WordPress site title. It calls the WordPress get_bloginfo function with the
show
parameter set to "name". The return
block parameter is set to true
because this function returns the result instead of echoing it.echo ( new HivePress\Blocks\Callback(
[
'callback' => 'get_bloginfo',
'params' => [ 'name' ],
'return' => true,
]
) )->render();
Last modified 1yr ago