我在一个网站上为工作设置了一个自定义的帖子类型,这一切都很好。当我在自定义帖子类型上单击作者(我的名字)时,尽管它会进入存档。php文件(如第3幅图所示)。
我将其设置为,当您单击第一张照片中显示的类别时,这将转到自定义分类法存档模板文件taxonomy-job_type.php
. 似乎没有作者cpt。php模板文件是否在模板层次结构中?
我如何设置它,当有人单击自定义帖子类型的作者时,它只显示作者的CPT帖子?
我已经包含了函数中的代码。php文件和正在发生的事情的图像。任何帮助都会很棒。
function job_post_types() {
register_post_type(\'job\', array(
\'rewrite\' => array(\'slug\' => \'jobs\'),
\'menu_icon\' => \'dashicons-id-alt\',
\'has_archive\' => true,
\'public\' => true,
\'publicly_queryable\' => true,
\'supports\' => array(\'title\', \'editor\', \'author\', \'excerpt\', \'custom-fields\'),
\'taxonomies\' => array(\'job_type\'), // we have used this from the taxonomies below. Default entry should be (\'category\', \'post_tag)
\'labels\' => array(
\'name\' => \'Jobs\',
\'add_new_item\' => \'Add New Job\',
\'edit_item\' => \'Edit Job\',
\'all_items\' => \'All Jobs\',
\'singular_name\' => \'Job\'
),
));
}
add_action(\'init\', \'job_post_types\');
function job_type_taxonomy(){
$labels = array(
\'name\' => \'Job Types\',
\'singular_name\' => \'Job Type\',
\'search_items\' => \'Search Job Types\',
\'all_items\' => \'All Job Types\',
\'parent_item\' => \'Parent Job Type\',
\'parent_item_colon\' => \'Parent Job Type:\',
\'edit_item\' => \'Edit Job Type\',
\'update_item\' => \'Update Job Type\',
\'add_new_item\' => \'Add New Job Type\',
\'new_item_name\' => \'New Job Type Name\',
\'menu_name\' => \'Job Type\',
);
$args = array(
\'hierarchical\' => true,
\'labels\' => $labels,
\'show_ui\' => true,
\'show_admin_column\' => true,
\'query_var\' => true,
\'rewrite\' => array( \'slug\' => \'job_type\' ),
);
register_taxonomy( \'job_type\', array( \'job\' ), $args );
}
add_action(\'init\', \'job_type_taxonomy\');
任何帮助都会很好
元中有我的作者名字“Paul”的CPT
单击我的名字后,我转到我名字的主博客索引存档页
显示当前模板文件插件确认存档。php是正在输出的模板文件。