【发布时间】:2016-11-30 15:43:08
【问题描述】:
我有一些帖子类型,但现在我需要在页面部分添加某些模板。
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');
【问题讨论】:
-
您是在问如何创建模板文件或如何将自定义字段添加到帖子类型(并在创建/编辑屏幕中显示它们)?
-
现在,我现在如何创建模板文件,但是当我尝试添加新的自定义帖子类型帖子时它们没有显示。
-
如——创建新帖子后,转到帖子的网址时无法在网站上查看?
-
是的,我收到 404 错误页面
-
您能否将创建帖子类型的代码粘贴到您的问题中?
标签: php wordpress wordpress-theming