2017-08-30, 01:11:42
Hello all,
In my theme i must to define if get_component('component-xyz') return null value.
I implement this function.
In this mode i can check if component return empty value (simply using "if" statement).
Do you resolve this problem in other way?
In my theme i must to define if get_component('component-xyz') return null value.
I implement this function.
PHP Code:
/**
* This return get_component() function in a string
*
* @param string $id - ID of the component
* @return string
*/
function return_get_component($id)
{
ob_start();
get_component($id);
$html = ob_get_clean();
return $html;
}
In this mode i can check if component return empty value (simply using "if" statement).
Do you resolve this problem in other way?