Thanks for providing this example framework. In the documentation examples, you express that you want to return wp_head() and other WP functions as string values. You can accomplish this with output buffering like so:
/**
* Fetches Wordpress Menu markup for specified theme location
* @var string $theme_location
* @return string
*/
public function getMenuContent($theme_location) {
ob_start();
wp_nav_menu( array( 'theme_location' => $theme_location ) );
$menu = ob_get_clean();
return $menu;
}
Thanks for providing this example framework. In the documentation examples, you express that you want to return wp_head() and other WP functions as string values. You can accomplish this with output buffering like so: