WP_Query
1 2 3 4 5 6 7 8 9 10 11 12 |
<?php $args = array( 'post_type' => 'post', 'posts_per_page' => 10 ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();?> <?php echo $the_query->current_post + 1;?> <?php endwhile;?> <?php endif;?> <?php wp_reset_postdata();?> |
コメント