标签: 调用文章

  • WordPress调用指定分类文章

    wordpress按分类ID调用指定分类的文章代码

    <?php
        $args=array(
            'cat' => 1,   // 分类ID
            'posts_per_page' => 10, // 显示篇数
    
        );
        query_posts($args);
    
        if(have_posts()) : while (have_posts()) : the_post();
    ?>
        <li>
            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> 
        </li>
    <?php  endwhile; endif; wp_reset_query(); ?>