小编Kan*_*nan的帖子

如何设置类别列表限制?

我是显示帖子类别子列表.列表显示所有我需要显示只有6(孩子)帮助我们...

ex:menu(父)list1(child)list2(child)list3(child)list4(child)list5(child)list6(child)list7(child)list8(child)

<?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="<?php the_permalink() ?>talent/directors/"><?php echo $talent->name; ?></a></h2>
        <ul>
        <?php while ($talentSubChildren->have_posts()) : $talentSubChildren->the_post(); ?>
        <li>
        <h4><a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
        </h4>
        </li>
        <?php endwhile; ?>
        </ul>
        <?php endforeach; ?>
        <?php endif; ?>
        </div>
Run Code Online (Sandbox Code Playgroud)

php wordpress wordpress-theming

4
推荐指数
1
解决办法
3851
查看次数

标签 统计

php ×1

wordpress ×1

wordpress-theming ×1