Single Child 分类及其模板文件(单-{}.php)

Single Child taxonomy and its template file (single-{}.php)

可能是个简单的问题。但是我到处找都没有找到。

首先,我有一个名为 "world" 的自定义 post 类型。在那里我有一个名为 "location" 的分类法和一个国家 "England" 作为父级。此分类的子项是 "London".

我的问题是:这个构造的 single.php 文件是什么?我试过:

但没有任何效果。它给了我一个 404。有人知道发生了什么事吗?

应阿米特的要求:

add_action( 'init', 'cptui_register_my_cpts_world' );
function cptui_register_my_cpts_world() {
    $labels = array(
        "name" => __( 'world', '' ),
        "singular_name" => __( 'world', '' ),
        );

    $args = array(
        "label" => __( 'world', '' ),
        "labels" => $labels,
        "description" => "",
        "public" => true,
        "show_ui" => true,
        "show_in_rest" => false,
        "rest_base" => "",
        "has_archive" => true,
        "show_in_menu" => true,
        "exclude_from_search" => false,
        "capability_type" => "post",
        "map_meta_cap" => true,
        "hierarchical" => false,
        "rewrite" => array( "slug" => "world", "with_front" => true ),
        "query_var" => true,
        "menu_position" => 20,"menu_icon" => "dashicons-palmtree",      
        "supports" => array( "title", "editor", "thumbnail" ),      
        "taxonomies" => array( "location" ),        
    );
    register_post_type( "world", $args );

// End of cptui_register_my_cpts_world()
}

使用 single-world.php 进行 CPT。并且不要忘记重置您的永久链接设置。