【发布时间】:2011-08-23 05:21:20
【问题描述】:
我使用wordpress网站的示例添加新的帖子类型,我使用wp3.2.1,如下
// Add custom post type for the case studies
add_action( 'init', 'create_casestudy_post_type' );
function create_casestudy_post_type() {
register_post_type( 'case_study',
array(
'labels' => array(
'name' => __( 'Case Studies' ),
'singular_name' => __( 'Case Studies' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'case-studies')
)
);
}
这段代码我已经放在了我的主题目录中的functions.php文件中。
问题是当我尝试查看 URL 时,它返回一个 404 页面未找到...我使用 single-case_study.php 作为页面模板,但它一直都是 404。
我的永久链接在自定义结构中设置为 /%category%/%postname%/。
有什么帮助吗? ..这真的让我很烦
干杯
【问题讨论】:
-
当您尝试查看帖子时,永久链接结构是什么样的?您是否通过管理面板中的链接查看帖子?
标签: wordpress wordpress-theming