【发布时间】:2015-02-18 07:55:22
【问题描述】:
我为 Wordpress 仪表板创建了两个菜单,第一个菜单正常运行,但第二个没有出现。我不知道为什么。
这是我的代码:
// Programme 2015 CPT
$labels = array(
'name' => _x( 'Programme 2015 HP', 'Post Type General Name', 'test' ),
'singular_name' => _x( 'Programme 2015 HP', 'Post Type Singular Name', 'test' ),
'menu_name' => __( 'Programme 2015 HP', 'test' ),
'parent_item_colon' => __( 'Parent Item:', 'test' ),
'all_items' => __( 'Tous les blocs programme 2015 en HP', 'test' ),
'view_item' => __( 'Voir le Programme 2015', 'test' ),
'add_new_item' => __( 'Ajouter un bloc au Programme 2015 en HP', 'test' ),
'add_new' => __( 'Ajouter', 'test' ),
'edit_item' => __( 'Editer', 'test' ),
'update_item' => __( 'Mettre à jour', 'test' ),
'search_items' => __( 'Chercher', 'test' ),
'not_found' => __( 'Not found', 'test' ),
'not_found_in_trash' => __( 'Not found in Trash', 'test' ),
);
$args = array(
'label' => __( 'programme-2015', 'test' ),
'description' => __( 'Les blocs programme dans la HP', 'test' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', ),
'hierarchical' => false,
'public' => false,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-media-text',
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'programme-2015', $args );
// Editions précédentes HP
$labels = array(
'name' => _x( 'Editions précédentes', 'Post Type General Name', 'test' ),
'singular_name' => _x( 'Editions précédentes', 'Post Type Singular Name', 'test' ),
'menu_name' => __( 'Editions précédentes', 'test' ),
'parent_item_colon' => __( 'Parent Item:', 'test' ),
'all_items' => __( 'Toutes les éditions précédentes', 'test' ),
'view_item' => __( 'Voir une édition précédente', 'test' ),
'add_new_item' => __( 'Ajouter une année précédente', 'test' ),
'add_new' => __( 'Ajouter', 'test' ),
'edit_item' => __( 'Editer', 'test' ),
'update_item' => __( 'Mettre à jour', 'test' ),
'search_items' => __( 'Chercher', 'test' ),
'not_found' => __( 'Not found', 'test' ),
'not_found_in_trash' => __( 'Not found in Trash', 'test' ),
);
$args = array(
'label' => __( 'editions-precedentes-hp', 'test' ),
'description' => __( 'Les blocs éditions précédentes en HP', 'test' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', ),
'hierarchical' => false,
'public' => false,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-microphone',
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'editions-precedentes-hp', $args );
}
"// Hook into the 'init' action
add_action( 'init', 'jm_custom_post_type', 0 );"
谁能解释我的问题?
【问题讨论】:
-
没有出现是什么意思?你在哪里叫它?您是否在 Admin 中为其分配了项目?您是否在管理员中分配了菜单?
-
它没有出现在左侧的仪表板管理菜单中,位于我创建的“Programme 2015 HP”下方。该数组由 functions.php 文件调用,如下所示:包括“inc/post-type.php”;我在哪里可以在管理员中分配项目和菜单?
标签: php wordpress menu dashboard