【发布时间】:2014-06-12 06:07:07
【问题描述】:
我在我的 wordpress 主题中定义了四个不同的分类术语,它们是
- 大陆
- 国家/地区
- 国家
- 城市
我的问题是我无法弄清楚如何让用户根据不同的分类来指定父子关系。 例如,如果用户在大洲下添加“亚洲”,在国家下添加“印度”,在州下添加“德里”,在城市下添加“新德里”,如何将印度指定为亚洲的孩子,德里作为印度的孩子,新德里作为孩子德里的 请帮我。谢谢。
自定义分类的代码是这样的: `
add_action('init', 'register_my_taxes_states');
function register_my_taxes_states() {
register_taxonomy( 'states',
array (
0 => 'schools',
1 => 'universities',
2 => 'institutes',
3 => 'colleges',
),
array( 'hierarchical' => true,
'label' => 'states',
'show_ui' => true,
'query_var' => true,
'show_admin_column' => false,
'labels' => array (
'search_items' => 'state',
'popular_items' => '',
'all_items' => '',
'parent_item' => '',
'parent_item_colon' => '',
'edit_item' => '',
'update_item' => '',
'add_new_item' => '',
'new_item_name' => '',
'separate_items_with_commas' => '',
'add_or_remove_items' => '',
'choose_from_most_used' => '',
)
) );
}
`
【问题讨论】: