我使用這段代碼:的WordPress:只顯示頂級類別
$args = array(
'orderby' => 'name',
'hierarchical' => 1,
'style' => 'none',
'taxonomy' => 'category',
'hide_empty' => 0,
'depth' => 1,
'title_li' => ''
);
$categories = get_categories($args);
我所試圖做的是隻列出頂級類別。當我使用這個代碼時,我將它們全部放在第一層。有人能幫我嗎?
沒有爲get_categories沒有深度參數()-http://codex.wordpress.org/Function_Reference/get_categories深度參數在wp_list_categories()中使用 - http://codex.wordpress.org/Template_Tags/wp_list_categories – McNab 2013-02-27 13:30:01