WordPress 内容页面(single页)调用文章所属当前分类下的所有文章列表

<?php
$singleurl = get_permalink($post_id);
$cats = wp_get_post_categories($post->ID);
if ($cats) {
    $args = array(
        'category__in'      => array( $cats[0] ),
        'showposts'         => 50,
        'caller_get_posts'  => 1,
        'order'             =>  'asc'
    );
    query_posts($args);
    if (have_posts()) :
        while (have_posts()) : the_post(); update_post_caches($posts); ?>
            <li>
                <a href="<?php the_permalink();?>"><?php the_title(); ?></a>
            </li>
        <?php endwhile; else : ?>
        <li> 暂无文章</li>
    <?php endif; wp_reset_query(); } ?>