2014-04-01 25 views

回答

0

在你的主題function.php:

register_nav_menus(array(
    'top_level_new' => __('Mail Navigation', 'twentyten'), 
)); 

上面的代碼塊允許您創建菜單的一個單獨的水平。

只需複製並粘貼代碼即可創建單獨的菜單級別。

轉到wp-admin面板。

從菜單選擇器中選擇菜單,將頁面添加到菜單中。

以下是允許您在前端獲取菜單的代碼塊。

<?php 

$defaults = array(
    'theme_location' => 'top_level_new', 
    'menu'   => '', 
    'container'  => 'div', 
    'container_class' => '', 
    'container_id' => '', 
    'menu_class'  => 'menu', 
    'menu_id'   => '', 
    'echo'   => true, 
    'fallback_cb'  => 'wp_page_menu', 
    'before'   => '', 
    'after'   => '', 
    'link_before'  => '', 
    'link_after'  => '', 
    'items_wrap'  => '<ul id="%1$s" class="%2$s">%3$s</ul>', 
    'depth'   => 0, 
    'walker'   => '' 
); 

wp_nav_menu($defaults); 

?> 
+0

但是,這將顯示所有菜單項,但是我只需要只頂部的菜單項。 – smrutiranjanpanda

+0

我已經編輯了答案,請現在檢查! –

相關問題