在WordPress主题中自定义菜单

1. 首先在主题的functions.php中注册菜单: register_nav_menus(array( ‘primary_nav’ => ‘Primary Navigation’, ‘secondary_nav’ => ‘Primary Navigation’ )); 2. 在后台的 Appearance -> Menus 中设置菜单项。 3. 在主题中显示菜单: wp_nav_menu( array(‘menu_class’ => ‘primary_nav’, ‘theme_location’ =>’primary_nav’) ); wp_nav_menu(); 函数支持丰富的参数,详 […]