我有以下自定义帖子类型:
if ( $args->has_archive ) {
$archive_slug = $args->has_archive === true ? $args->rewrite[\'slug\'] : $args->has_archive;
if ( $args->rewrite[\'with_front\'] )
$archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug;
else
$archive_slug = $wp_rewrite->root . $archive_slug;
register_post_type( \'jobs\',
array(
\'labels\' => array(
\'name\' => __( \'Jobs\' ),
\'singular_name\' => __( \'Job\' )
),
\'public\' => true,
\'show_ui\' => true,
\'has_archive\' => $archive_slug,
\'hierarchical\' => true,
\'query_var\' => true,
\'supports\' => array( \'title\', \'editor\', \'comments\', \'trackbacks\', \'revisions\',\'author\', \'excerpt\', \'custom-fields\', \'thumbnail\', \'page-attribute\' ),
\'rewrite\' => array(\'slug\' => \'jobs\', \'with_front\' => true),
\'taxonomies\' => array( \'post_tag\', \'category\'),
\'can_export\' => true,
\'show_in_nav_menus\' => true,
//\'capability_type\'=>\'jobs\',
//\'capabilities\' => array(
// \'read_post\' => \'read_jobs\'
//),
)
);
现在,它正在使用模板
archive-jobs.php
(WordPress的默认模板系统)。现在,我要做的是使用一个名为
jobs-page.php
对于url
mysite.com/jobs
但这是不可能的,因为WordPress会自动捕捉到
/jobs
并将其重定向到存档模板。我试过这么做
\'has_archive\' => false,
但是WordPress使用
archive.php
对于
mysite.com/jobs
.
处理这个问题的最佳方式是什么?