Wordpress存档页面不基于自定义帖子类型

时间:2013-06-16 12:17:20

标签: wordpress archive custom-post-type

好的,所以我制作了这个wordpress archive-mynews.php和一个单一的mynews.php single-mynews.php包含让wordpress知道这是我的单页“模板名称:Single Mynews”的评论。

现在,当我点击http://url.com/mynews时,它会将我重定向到主页而不是我刚刚创建的存档页面。为什么会这样,我忘了什么?

我已在functions.php中创建了自定义帖子类型 我做的就像点击。

add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'mynews',
        array(
            'labels' => array(
                'name' => __( 'Mynews' ),
                'rewrite' => array('slug' => 'mynews'),
                'singular_name' => __( 'Mynews' )
            ),
        'public' => true,
        'has_archive' => true,
        'hierarchical' => true,
        'supports' => array('title','editor','thumbnail'),
        )
    );
}

任何人都可以告诉我为什么它不起作用或我忘记了什么因为我无法解决这个问题。

提前致谢。

1 个答案:

答案 0 :(得分:0)

我通过转到“设置>永久链接”解决了这个问题,只需点击保存更改按钮即可让更改生效。