duancao2082 2016-06-08 10:57
浏览 59
已采纳

单子分类法及其模板文件(单 - {。。php)

Simple question probably. But I have looked everywhere and I couldn't find it.

First I have a custom post type called "world". In there I have a Taxonomy called "location" and a country "England" as parent. The child of this taxonomy is "London".

My question is: what is the single.php file for this construction? I have tried:

  • single-location.php
  • single-england.php
  • single-location-england.php
  • single-england-london.php

But nothing works. It gives me a 404. Anyone know's whats going on?

As requested by Amit:

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()
}
  • 写回答

1条回答 默认 最新

  • douchong8393 2016-06-08 12:56
    关注

    Use single-world.php for CPT. and also don't forgot to reset your permalinks settings.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突