HighLab

wordpress 一覧取得

  • 公開日:
  • 更新日:
  • 文字数:732文字
<?php
                $args = array(
                  'post_type' => 'post',
                  'posts_per_page' => 10,
                  //'category__not_in' => array(5)
                  'cat' =>1
                  );
                ?>
                <?php $the_query = new WP_Query( $args ); ?>
                <?php if ( $the_query->have_posts() ) : ?>
                  <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                    <?php get_template_part('inc/top-news'); ?>
                  <?php endwhile; ?>
                <?php else : ?>
                <?php endif; ?>
                <?php wp_reset_postdata(); ?>