theme development - Custom post type single page uses the right template in preview mode but shows a different template after be

I've been developing a Wordpress theme. I've created a custom post type called blog in functions.php.Blog

I've been developing a Wordpress theme. I've created a custom post type called blog in functions.php.

// Blog Post Type Creation
function te_blog_type() {
    register_post_type("blog",
        array(
            "rewrite" => array("slug" => "blogs"),
            "labels" => array(
                "name" => "Blogs",
                "singular_name" => "Blog",
                "add_new_item" => "Add New Blog",
                "edit_item" => "Edit Blog"
            ),
            "menu-icon" => "dashicons-format-status",
            "public" => true,
            "has_archive" => true, 
            "supports" => array(
                "title", "thumbnail", "editor", "excerpt", "comments"
            ),
            "taxonomies" => array("category", "post_tag", "blog_tag")
        )
    );
}

add_action("init", "te_blog_type");

It's been working fine.

I also created a single-blog.php file as template for each blog post. When I preview the blog post. It's using the right template from single-blog.php. However, when I actually post the blog, it's showing the index.php as the template. What caused this?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745239207a4618075.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信