0
我有一些帖子类型,但现在我需要添加页面部分中的某些模板。如何为自定义帖子类型添加自己的主题模板?
function products_init() {
$args = array(
'label' => 'Products',
'capability_type' => 'page',
'menu_icon' => 'dashicons-cart',
'taxonomies' => array('category'),
'rewrite' => array('slug' => 'products'),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'menu_position' => 4,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'query_var' => true,
'supports' => array('title', 'editor', 'thumbnail', 'page-attributes')
);
register_post_type('products', $args);
}
add_action('init', 'products_init');
您是否在问如何创建模板文件或如何将自定义字段添加到帖子类型(并在创建/编辑屏幕中显示它们)? –
现在,我现在如何创建模板文件,但是当我尝试添加新的自定义帖子类型帖子时,它们不会显示。 –
如您在创建新帖子后,当您转到帖子的网址时,您无法在网站上查看它? –