WordPress 分类页 category 获取当前分类下所有文章

<?php
        // 获取当前分类下所有文章
        $args = array(
            'category__in' => $cat,  // 显示指定分类。cat可以在category页直接得到分类ID
            'order' => 'DESC',
        );
        // 下面这一行代码是必须的,不然不能分页
        $arms = array_merge($args, $wp_query->query);
        query_posts($arms);
        if (have_posts()) :
            while (have_posts()) : the_post(); update_post_caches($posts); ?>
                <?php get_template_part('template/category-li')?>
            <?php endwhile; else : ?>
            <li>暂无文章</li>
        <?php endif; wp_reset_query();  ?>