2016-03-21 29 views
0
/*My header menu code*/ 

$args = array(
    'theme-location' => 'primary' 
); 
wp_nav_menu($args); 

/*My footer menu code*/ 
$args = array(
    'theme-location' => 'footer' 
); 
wp_nav_menu($args); ?> 

我functions.php文件如何設置菜單在WordPress

register_nav_menus(
array(
    'primary' => __('Main Primary Menu'), 
    'footer'=> __('Footer Menu'), 
    ) 
); 

當我選擇的頁眉和頁腳不同的菜單,因此,優先考慮頁腳菜單和設置頁腳菜單在頭也是,但是當我刪除頁腳菜單,然後它設置菜單,我選擇了標題,這是什麼問題?

回答

0

使用下面的代碼

/*My header menu code*/ 

$header_args = array(
    'theme-location' => 'primary' 
); 
wp_nav_menu($header_args); 

/*My footer menu code*/ 
$footer_args = array(
    'theme-location' => 'footer' 
); 
wp_nav_menu($footer_args); 
+1

儘管此代碼可以回答這個問題,提供 關於_why_和/或_how_它回答 問題將顯著改善其長期 值附加的上下文。請[編輯]你的答案,添加一些解釋。 –