我创建了一个自定义帖子,并制作了一个名为 single-postname.php 的模板文件
在我被重定向回主页之前,我无法加载模板文件,但在刷新 .htaccess 文件后,我只是得到一个空白页。
我尝试再次删除和添加帖子,更改了几次永久链接,并更改了主题,似乎没有任何效果。我还能做些什么来尝试强制 WordPress 再次查找文件?
register_post_type
$labels = array(
'name' => _x( 'Conversations', 'conversation' ),
'singular_name' => _x( 'Conversation', 'conversation' ),
'add_new' => _x( 'Add New', 'conversation' ),
'add_new_item' => _x( 'Add New Conversation', 'conversation' ),
'edit_item' => _x( 'Edit Conversation', 'conversation' ),
'new_item' => _x( 'New Conversation', 'conversation' ),
'view_item' => _x( 'View Conversation', 'conversation' ),
'search_items' => _x( 'Search Conversations', 'conversation' ),
'not_found' => _x( 'No conversations found', 'conversation' ),
'not_found_in_trash' => _x( 'No conversations found in Trash', 'conversation' ),
'parent_item_colon' => _x( 'Parent Conversation:', 'conversation' ),
'menu_name' => _x( 'Conversations', 'conversation' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'description' => 'conversation between users on the site',
'supports' => array( 'title', 'excerpt', 'author', 'comments', 'custom-fields' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 20,
//'menu_icon' => 'http://findicons.com/files/icons/2229/social_media_mini/24/google_talk.png',
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
'capability_type' => 'post'
);
register_post_type( 'conversation', $args );
文件名=single-conversation.php