2016-03-21 70 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_它回答 问题将显著改善其长期 值附加的上下文。请[编辑]你的答案,添加一些解释。 –