Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION Best way to wrap "get_component()"
#1
Information 
Hello all,

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?
Reply


Messages In This Thread
Best way to wrap "get_component()" - by tempUser - 2017-08-30, 01:11:42



Users browsing this thread: 1 Guest(s)