SO网友:Dan.
1-复制父主题的header.php
融入您的孩子主题。
2-要创建自定义字段,如果您不太了解WP,我建议使用Advanced Custom Fields plugin.
阅读他们网站上的文档。您希望创建一个选择/下拉或单选类型字段,并将其用于所有帖子类型和页面。
对于您拥有的每个菜单,为自定义字段指定一个值。
为自定义字段指定一个默认值-您将使用最多的菜单的默认值(这样可以节省一些时间)
3-给其他页面/帖子另一个菜单。
4-在子主题的标题中。php,更改此选项:
<?php if(\'true\' == $ubermenu):
wp_nav_menu(array(
\'theme_location\' => \'Primary Navigation\' ,
\'depth\' => 0 ,
\'container\' => false ,
\'walker\' => new description_walker() ));
else: ?>
<ul id="menu-main-nav" class="sf-menu">
<?php wp_nav_menu(array(
\'theme_location\' => \'Primary Navigation\' ,
\'depth\' => 0 ,
\'container\' => false ,
\'walker\' => new description_walker() )); ?>
</ul>
<?php endif; //end uberMenu check ?>
收件人:
<?php
$menu_to_use = get_field(get_the_ID(), \'meta_key_of_custom_field\');
if(\'true\' == $ubermenu):
wp_nav_menu(array(
\'theme_location\' => $menu_to_use, // make sure that the values of the custom field are the names of the menus (e.g. Primary Menu)
\'depth\' => 0 ,
\'container\' => false ,
\'walker\' => new description_walker() ));
else: ?>
<ul id="menu-main-nav" class="sf-menu">
<?php wp_nav_menu(array(
\'theme_location\' => $menu_to_use, // make sure that the values of the custom field are the names of the menus (e.g. Primary Menu)
\'depth\' => 0 ,
\'container\' => false ,
\'walker\' => new description_walker() )); ?>
</ul>
<?php endif; //end uberMenu check ?>