Php 使用自定义模板时,自定义帖子类型帖子不会显示
这在“我的设置”中的“注册帖子类型”下:Php 使用自定义模板时,自定义帖子类型帖子不会显示,php,wordpress,Php,Wordpress,这在“我的设置”中的“注册帖子类型”下: register_post_type( 'support', /* (http://codex.wordpress.org/Function_Reference/register_post_type) */ // let's now add all the options for this post type array( 'labels' => array( 'name' => __( 'Support',
register_post_type( 'support', /* (http://codex.wordpress.org/Function_Reference/register_post_type) */
// let's now add all the options for this post type
array( 'labels' => array(
'name' => __( 'Support', 'bonestheme' ), /* This is the Title of the Group */
'singular_name' => __( 'Support', 'bonestheme' ), /* This is the individual type */
'all_items' => __( 'All support', 'bonestheme' ), /* the all items menu item */
'add_new' => __( 'Add New', 'bonestheme' ), /* The add new menu item */
'add_new_item' => __( 'Add New Support', 'bonestheme' ), /* Add New Display Title */
'edit' => __( 'Edit', 'bonestheme' ), /* Edit Dialog */
'edit_item' => __( 'Edit Support', 'bonestheme' ), /* Edit Display Title */
'new_item' => __( 'New Support', 'bonestheme' ), /* New Display Title */
'view_item' => __( 'View Support', 'bonestheme' ), /* View Display Title */
'search_items' => __( 'Search Support', 'bonestheme' ), /* Search Custom Type Title */
'not_found' => __( 'Nothing found in the Database.', 'bonestheme' ), /* This displays if there are no entries yet */
'not_found_in_trash' => __( 'Nothing found in Trash', 'bonestheme' ), /* This displays if there is nothing in the trash */
'parent_item_colon' => ''
), /* end of arrays */
'description' => __( 'This is the example for a slide', 'bonestheme' ), /* Custom Type Description */
'public' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'show_ui' => true,
'query_var' => true,
'menu_position' => 8, /* this is what order you want it to appear in on the left hand side menu */
'menu_icon' => get_stylesheet_directory_uri() . '/library/images/custom-post-icon.png', /* the icon for the custom post type menu */
'rewrite' => array( 'slug' => 'support', 'with_front' => false ), /* you can specify its url slug */
'has_archive' => 'custom_type', /* you can rename the slug here */
'capability_type' => 'post',
'hierarchical' => false,
'taxonomies' => array('category'),
/* the next one is important, it tells what's enabled in the post editor */
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'sticky')
) /* end of options */
); /* end of register post type */
在该自定义帖子类型下创建页面时,页面将被正确路由和永久对齐。但是,当我加载页面时,会显示默认错误
我还创建了single-support.php页面,目前它只是一个空白页面,因此我可以看到一个空白页面加载,以确保其正常工作
知道为什么这似乎不起作用吗?来自wordpress post type文档: “注意:在某些情况下,必须更新permalink结构才能使用新的 查看自定义文章类型的文章时要访问的模板文件。要执行此操作,请转到“管理面板”>“设置”>“永久链接”,将永久链接结构更改为其他结构,保存更改,然后将其更改回所需结构。“
这正是解决问题的方法 此代码在这里运行良好。您有什么问题?