【问题标题】:Wordpress - Weird post template issueWordpress - 奇怪的帖子模板问题
【发布时间】: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


【解决方案1】:

您可以使用Custom Post Type UI plugin 创建自定义帖子类型。

【讨论】:

    猜你喜欢
    • 2012-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-16
    • 1970-01-01
    • 2021-11-16
    • 2012-12-30
    相关资源
    最近更新 更多