所需行为:
自定义帖子类型slug:研究人员、学生、合作者
URL:http://domainexample.com/people/researchers, http://domainexample.com/people/students, http://domainexample.com/people/collaborators<模板文件:存档人员。php
如何设置自定义帖子类型以实现此行为
我想在不使用分类法的情况下完成它
可能吗?
试图设置has_archive
slug和rewrite
缓动至people/researchers
, 虽然加载的模板文件仍为arquive,但仍会加载帖子。php。
当前“研究人员”自定义帖子类型注册码:
$args = array(
"label" => __( "Researchers", "" ),
"labels" => $labels,
"description" => "",
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"show_in_rest" => true,
"rest_base" => "",
"has_archive" => "people/researchers",
"show_in_menu" => true,
"exclude_from_search" => false,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => false,
"rewrite" => array( "slug" => "people/researchers", "with_front" => true ),
"query_var" => true,
"supports" => array( "title" ),
);
register_post_type("researchers", $args);
谢谢你