Calls function given by the first parameter and passes the remaining parameters as arguments.
The main purpose of this function is to store the content echoed by a function in a variable.
beans_render_function( callback $callback )
Return: (string) The callback content.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
$callback | callback | true | - | The callback to be called. |
$var | mixed | true | - | Additional parameters to be passed to the callback. |
Source
function beans_render_function( $callback ) {
if ( ! is_callable( $callback ) ) {
return;
}
$args = func_get_args();
ob_start();
call_user_func_array( $callback, array_slice( $args, 1 ) );
return ob_get_clean();
}