我使用这段代码:的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