Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 在子主题中注册附加菜单_Wordpress_Menu_Themes_Registering - Fatal编程技术网

Wordpress 在子主题中注册附加菜单

Wordpress 在子主题中注册附加菜单,wordpress,menu,themes,registering,Wordpress,Menu,Themes,Registering,我试图在child theme function.php中注册额外的菜单位置,如下所示。但菜单位置未显示在管理面板中。我做错了什么 function hb_register_slider_menu() { register_nav_menu('slider-section-menu', __('slider-section-menu', 'hbthemes')); } add_action('init', 'hb_register_slider_menu'); 你试过用这种方法吗

我试图在child theme function.php中注册额外的菜单位置,如下所示。但菜单位置未显示在管理面板中。我做错了什么

function hb_register_slider_menu() {

    register_nav_menu('slider-section-menu', __('slider-section-menu', 'hbthemes'));

}
add_action('init', 'hb_register_slider_menu');

你试过用这种方法吗

<?php
add_action( 'after_setup_theme', 'slider_section_menu' );
function slider_section_menu() {
  register_nav_menu( 'slider-section-menu', __( 'Slider Menu', 'theme-slug' ) );
}
?>

参考: