我正在尝试在WordPress中创建自定义帖子。我按照下面的代码注册帖子。代码正在运行。但菜单没有显示在Dashedboard中。
<?php
function app_theme_custom_posts () {
register_post_type('prime', array(
'label' => 'Prime',
'labels' => array(
'name' => 'Primes',
'singular_name' => 'Prime',
),
'public' => 'true',
'menu_icon' => 'dashicons-images-alt',
'supports' => array('title', 'editor', 'thumbnail','custom-fields'),
));
}
add_action('init','app_theme_custom_posts');
?>
答案 0 :(得分:0)
试试这个 -
<?php
function app_theme_custom_posts () {
register_post_type('prime', array(
'labels' => array(
'name' => __('Primes'),
'singular_name' => __('Prime'),
'add_new' => __('New Prime)'
),
'public' => true,
'has_archive' => false,
'menu_icon' => 'dashicons-images-alt',
'supports' => array('title', 'editor', 'thumbnail','custom-fields'),
));
}
add_action('init','app_theme_custom_posts');
?>