【问题标题】:Wordpress arvhive page doesn't based on custom post typeWordpress arvhive 页面不基于自定义帖子类型
【发布时间】:2013-06-12 13:32:17
【问题描述】:

好的,所以我制作了这个 wordpress archive-mynews.php 和一个 single-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'),
        )
    );
}

谁能告诉我为什么它不起作用或我忘记了什么,因为我无法缝合。

提前致谢。

【问题讨论】:

  • 你在archive-mynews.php中使用了什么代码?
  • 我修好了,一切正常。我只需要在“设置”>“永久链接”下重新更新永久链接的设置,我只需点击此按钮,之后一切正常。有点奇怪,我必须更新永久链接设置才能让更改生效!

标签: wordpress archive custom-post-type


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多