php - WordPress get data into variables -
i having trouble figuring out how data instead of printing it. want data , store variables.
i want navbar instead of printing it, how can store in variable $navbar
?
wp_nav_menu( array('menu_class' => 'nav navbar-nav navbar-right','theme_location' => 'primary','container' => false,) )
can try below code:
<?php $navbar = ''; ob_start(); wp_nav_menu( array('menu_class' => 'nav navbar-nav navbar-right','theme_location' => 'primary','container' => false) ); $navbar = ob_get_contents(); ob_end_clean(); echo $navbar; ?>
Comments
Post a Comment