嗨,我已经创建了一个名为shows的自定义帖子类型。
这是它的代码。
<?php
add_action(\'init\', \'show_register\');
function show_register() {
//arguments to create the post type.
$args = array(
\'label\' => __(\'shows\'),
\'singular_label\' => __(\'Show\'),
\'public\' => true,
\'show_ui\' => true,
\'capability_type\' => \'post\',
\'hierarchical\' => true,
\'has_archive\' => true,
\'supports\' => array(\'title\', \'editor\', \'thumbnail\', \'custom-fields\'),
\'rewrite\' => array(\'slug\' => \'shows\', \'with_front\'
=> false), );
//Register type and custom taxonomy for type.
register_post_type( \'shows\' , $args );
register_taxonomy("Show-type", array("shows"),
array("hierarchical" => true, "label" => "Show
Types", "singular_label" => "Show Type", "rewrite"
=> true, "slug" => \'show-type\'));
}
?>
我已经创建了2个文件,它们遵循wordpress层次结构并调用了它们archive-shows.php
和single-shows.php
. 这些应该自动链接到正确的页面,但由于某些原因,它们都默认返回索引。php。正常的single.php
和archive.php
正常工作。
Fix尝试了Permalinks Flushedarchive = true
请提供任何建议。