如何设置分类列表限制()

【如何设置分类列表限制()】我正在显示帖子类别子列表。列表仅显示我需要显示的所有6(子项)帮助我们…
例如:菜单(父项)list1(子项)list2(子项)list3(子项)list4(子项)list5(子项)list6(子项)list7(子项)list8(子项)

< ?php $article_categories = get_categories(array( 'child_of' => get_category_by_slug('work')-> term_id )); $talentChildren = get_categories(array('child_of' => get_category_by_slug('talent')-> term_id)); ?> < ?php if ( have_posts()) : ?> < ?php $talent_Children = array($talentChildren[0]); ?> < ?php foreach($talent_Children as $talent): ?> < ?php $talentSubChildren = new WP_Query(); $talentSubChildren-> query(array('category_name' => $talent-> slug)); ?> < h2> < a href="http://www.srcmini.com/< ?php the_permalink() ?> talent/directors/"> < ?php echo $talent-> name; ?> < /a> < /h2> < ul> < ?php while ($talentSubChildren-> have_posts()) : $talentSubChildren-> the_post(); ?> < li> < h4> < a href="http://www.srcmini.com/< ?php the_permalink() ?>"> < ?php the_title(); ?> < /a> < /h4> < /li> < ?php endwhile; ?> < /ul> < ?php endforeach; ?> < ?php endif; ?> < /div>

#1你可以在get_categories函数中将用户号码= 6
$talentChildren = get_categories(array('child_of' => get_category_by_slug('news')-> term_id, 'number' => 6, 'hide_empty' => 0)); foreach($talentChildren as $talent): echo "< pre> "; print_r($talent); echo "< /pre> "; endforeach;

    推荐阅读