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

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -