i want to fetch the menu with items dynamically..
This is my code what i have tried :
<?php wp_nav_menu(array( 'theme_location' => 'primary','menu_class' => 'nav navbar-nav' ,'menu' => 'tahrid'));?>
答案 0 :(得分:0)
首先,将此代码添加到 functions.php 文件中。
register_nav_menus( array(
'header-top' => __( 'Header Top', 'twentyseventeen' )
) );
然后在 index.php 上添加对我有用的内容。
?php if ( has_nav_menu( 'header-top' ) ) : ?>
<?php wp_nav_menu( array(
'theme_location' => 'header-top',
'menu_id' => 'header-top',
) ); ?>
<?php endif; ?>