你的add_theme_support()
调用语法不正确。它应该是:
add_theme_support( $feature, $callback )
在哪里
$feature
= \'“管理栏”,和
$callback
=
\'callback_function_name\'
是否定义了回调?
更重要的是:are you absolutely sure you even need to enable Theme support for this feature? 仅当覆盖管理工具栏的默认行为时才需要它。
编辑要为导航菜单添加主题支持,您需要添加separate call 到add_theme_support()
. But really, 你不需要打电话add_theme_support()
直接用于自定义导航菜单。简单呼叫register_nav_menus()
, WordPress将负责添加主题支持。e、 g.:
register_nav_menus( array(
\'primary_menu\' => \'Primary Menu\',
\'footer_menu\' => \'Footer Menu\'
) );
因此,将它们放在一起(并在回调中正确包装):
function wpse45721_theme_setup() {
// Add Theme Admin Bar OVerride SUpport
add_theme_support( \'admin-bar\', \'wpse45721_admin_bar_cb\' );
// Add Theme Support For Custom Nav Menus
register_nav_menus( array(
\'primary_menu\' => \'Primary Menu\',
\'footer_menu\' => \'Footer Menu\'
) );
}
add_action( \'after_setup_theme\', \'wpse45721_theme_setup\' );
function wpse45721_admin_bar_cb() {
// What goes here is up to you
}