如何在页面属性上显示帖子类型?例如,我有一个自定义的帖子类型product
, 我想要show it页面属性alongside 现有WP岗位类型:page
, post
.
所以我想要所以有一个dropdown options 用户可以switch around 这些职位类型:
post
page
product
我的代码输入
functions.php
:
function product_init() {
$args = array(
\'labels\' => array(
\'name\' => __(\'Products\'),
\'singular_name\' => __(\'Product\'),
\'all_items\' => \'All Products\'
),
\'public\' => true,
\'show_ui\' => true,
\'capability_type\' => \'page\',
\'hierarchical\' => true,
// \'rewrite\' => array(\'slug\' => \'Products\'),
\'query_var\' => true,
\'menu_icon\' => \'dashicons-star-filled\',
\'supports\' => array(
\'title\',
\'editor\',
// \'excerpt\',
// \'trackbacks\',
//\'custom-fields\',
//\'comments\',
\'revisions\',
\'thumbnail\',
\'author\',
\'page-attributes\',
)
);
register_post_type( \'product\', $args );
}
add_action( \'init\', \'product_init\' );
有什么想法吗?