"Menus" 设置从 WordPress 管理面板中消失了
"Menus" settings disappeared from WordPress admin panel
我需要更改我的 WordPress 网站上的一些菜单项,但该选项已从管理区域中消失。根据 documentation,Menus 选项应该出现在 Appearance 菜单下,但在我的安装中没有:
如何让菜单出现在它应该出现的位置?
问题可能是由流氓插件覆盖功能引起的,但我设法通过使用以下代码将 functions.php
文件添加到我的自定义主题(在根目录中)来修复它:
<?php
add_theme_support( 'menus' );
?>
现在菜单又出现了:
此代码用于在 wp 管理中创建菜单。
![add_action('init', 'create_portfolio_post_type');
function create_portfolio_post_type() {
$args = array(
'description' => 'Portfolio Post Type',
'show_ui' => true,
'menu_position' => 4,
'exclude_from_search' => true,
'labels' => array(
'name' => 'Portfolios',
'singular_name' => 'Portfolios',
'add_new' => 'Add New Portfolio',
'add_new_item' => 'Add New Portfolio',
'edit' => 'Edit Portfolios',
'edit_item' => 'Edit Portfolio',
'new-item' => 'New Portfolio',
'view' => 'View Portfolios',
'view_item' => 'View Portfolio',
'search_items' => 'Search Portfolios',
'not_found' => 'No Portfolios Found',
'not_found_in_trash' => 'No Portfolios Found in Trash',
'parent' => 'Parent Portfolio'
),
'public' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => true,
'supports' => array('title', 'editor', 'thumbnail', 'comments', 'tags')
);
register_post_type('portfolio', $args);
}
您还可以在 functions.php
中使用此代码来对菜单选项卡设置进行更多操作:
//menu//
function register_my_menus() {
register_nav_menus(
array( 'top-menu' => __( 'Top-Menu' ) )
);
}
您还可以根据需要添加许多菜单字段并将其替换到您的主题中。
确保您的文件名为 functions.php
我需要更改我的 WordPress 网站上的一些菜单项,但该选项已从管理区域中消失。根据 documentation,Menus 选项应该出现在 Appearance 菜单下,但在我的安装中没有:
如何让菜单出现在它应该出现的位置?
问题可能是由流氓插件覆盖功能引起的,但我设法通过使用以下代码将 functions.php
文件添加到我的自定义主题(在根目录中)来修复它:
<?php
add_theme_support( 'menus' );
?>
现在菜单又出现了:
此代码用于在 wp 管理中创建菜单。
![add_action('init', 'create_portfolio_post_type');
function create_portfolio_post_type() {
$args = array(
'description' => 'Portfolio Post Type',
'show_ui' => true,
'menu_position' => 4,
'exclude_from_search' => true,
'labels' => array(
'name' => 'Portfolios',
'singular_name' => 'Portfolios',
'add_new' => 'Add New Portfolio',
'add_new_item' => 'Add New Portfolio',
'edit' => 'Edit Portfolios',
'edit_item' => 'Edit Portfolio',
'new-item' => 'New Portfolio',
'view' => 'View Portfolios',
'view_item' => 'View Portfolio',
'search_items' => 'Search Portfolios',
'not_found' => 'No Portfolios Found',
'not_found_in_trash' => 'No Portfolios Found in Trash',
'parent' => 'Parent Portfolio'
),
'public' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => true,
'supports' => array('title', 'editor', 'thumbnail', 'comments', 'tags')
);
register_post_type('portfolio', $args);
}
您还可以在 functions.php
中使用此代码来对菜单选项卡设置进行更多操作:
//menu//
function register_my_menus() {
register_nav_menus(
array( 'top-menu' => __( 'Top-Menu' ) )
);
}
您还可以根据需要添加许多菜单字段并将其替换到您的主题中。 确保您的文件名为 functions.php