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

Popular posts from this blog

c++ - list<myClass<int> * > sort -

c - Defining floating point constants, how many digits are useful? -

C# Apple Bonjour - how to monitor service records within Windows -