我在内置的附件帖子类型中添加了一个名为“颜色”的分类法。在编辑“列表”视图中的项目时,我可以看到分类法,但在使用“网格”视图时,我无法看到/使用分类法的术语。
列表视图:
网格视图:
我希望分类法也显示在网格视图中,但不明白为什么它不这样做。
这是我注册自定义分类法的代码:
function nij_register_taxonomies() {
$taxonomy_names = array(
\'singular\' => __( \'Color\', \'stufig\' ),
\'plural\' => __( \'Colors\', \'stufig\' )
);
register_taxonomy( strtolower($taxonomy_names[\'singular\']),
array(\'attachment\'),
array(
\'labels\' => array(
\'name\' => sprintf( _x( \'%s\', \'taxonomy general name\', \'stufig\' ), $taxonomy_names[\'plural\'] ),
\'singular_name\' => sprintf( _x( \'%s\', \'taxonomy singular name\', \'stufig\' ), $taxonomy_names[\'singular\'] ),
\'search_items\' => sprintf( __( \'Search %s\', \'stufig\' ), $taxonomy_names[\'plural\'] ),
\'all_items\' => sprintf( __( \'All %s\', \'stufig\' ), $taxonomy_names[\'plural\'] ),
\'parent_item\' => sprintf( __( \'Parent %s\', \'stufig\' ), $taxonomy_names[\'singular\'] ),
\'parent_item_colon\' => sprintf( __( \'Parent %s:\', \'stufig\' ), $taxonomy_names[\'singular\'] ),
\'edit_item\' => sprintf( __( \'Edit %s\', \'stufig\' ), $taxonomy_names[\'singular\'] ),
\'update_item\' => sprintf( __( \'Update %s\', \'stufig\' ), $taxonomy_names[\'singular\'] ),
\'add_new_item\' => sprintf( __( \'Add New %s\', \'stufig\' ), $taxonomy_names[\'singular\'] ),
\'new_item_name\' => sprintf( __( \'New %s Name\', \'stufig\' ), $taxonomy_names[\'singular\'] ),
\'menu_name\' => sprintf( __( \'%s\', \'stufig\' ), $taxonomy_names[\'plural\'] )
),
\'public\' => false,
\'hierarchical\' => true,
\'show_ui\' => true,
\'show_admin_column\' => true,
\'query_var\' => true,
\'show_in_nav_menus\' => true,
\'show_tagcloud\' => false,
\'update_count_callback\' => \'_update_generic_term_count\',
// \'rewrite\' => array(),
)
);
}
add_action( \'init\', \'nij_register_taxonomies\', 11 );