我有一个包含以下数据的CPTUI:
function cptui_register_my_cpts_activaties() {
/**
* Post Type: Activaties.
*/
$labels = array(
"name" => __( "Activaties", "red-button" ),
"singular_name" => __( "Activatie", "red-button" ),
);
$args = array(
"label" => __( "Activaties", "red-button" ),
"labels" => $labels,
"description" => "",
"public" => false,
"publicly_queryable" => true,
"show_ui" => true,
"delete_with_user" => false,
"show_in_rest" => true,
"rest_base" => "",
"rest_controller_class" => "WP_REST_Posts_Controller",
"has_archive" => false,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"exclude_from_search" => false,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => true,
"rewrite" => array( "slug" => "activaties", "with_front" => false ),
"query_var" => true,
"supports" => array( "title" ),
);
register_post_type( "activaties", $args );
}
add_action( \'init\', \'cptui_register_my_cpts_activaties\' );
现在我也创建了一个页面,它是另一个页面的子页面。看起来是这样的:
- Activaties
-- Aanleveren
所以的url
Aanleveren
成为
/activaties/aanleveren
, 这与CPTUI完全相同。
What I want:当未找到作为CPTUI的帖子时,我想查询post_type
第页。
这可能吗?如果是,我如何才能做到这一点?