Wordpress管理员外观侧显示辅助菜单中的无效菜单项。我正在child theme和custom post type工作。请查看我的代码以获取自定义帖子类型,并查看代码以注册辅助菜单。
//Register Post Type
add_action('init', 'portfolio_register');
function portfolio_register() {
$labels = array(
'name' => _x('portfolio', 'post type general name'),
'singular_name' => _x('Portfolio Item', 'post type singular name'),
'add_new' => _x('Add New', 'portfolio item'),
'add_new_item' => __('Add New Portfolio Item'),
'edit_item' => __('Edit Portfolio Item'),
'new_item' => __('New Portfolio Item'),
'view_item' => __('View Portfolio Item'),
'search_items' => __('Search Portfolio'),
'not_found' => __('Nothing found'),
'not_found_in_trash' => __('Nothing found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','editor','thumbnail')
);
register_post_type( 'portfolio' , $args );
}
register_taxonomy("Skills", array("portfolio"), array("hierarchical" => true, "label" => "Skills", "singular_label" => "Skill", "rewrite" => true));
register_nav_menus(array(
'primary' => 'Primary Menu',
'secondary' => 'Secondary Menu',
));