我会这样做:
<?php
//Protect against arbitrary paged values
$paged = ( get_query_var( \'paged\' ) ) ? absint( get_query_var( \'paged\' ) ) : 1;
$args = array(
\'posts_per_page\' => 6,
\'category_name\' => \'case-study\',
\'paged\' => $paged,
\'show_all\' => False,
\'prev_next\' => True
);
$the_query = new WP_Query( $args );
?>
<?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
//Insert your data feed here - links / images / text etc etc
<?php endwhile; ?>
分页代码如下:
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
\'base\' => str_replace( $big, \'%#%\', esc_url( get_pagenum_link( $big ) ) ),
\'format\' => \'?paged=%#%\',
\'prev_next\' => \'true\',
\'type\' => \'list\',
\'link_before\' => \'\',
\'link_after\' => \'\',
\'prev_text\' => __(\'< FIRST\'),
\'next_text\' => __(\'LAST >\'),
\'show_all\' => \'true\',
\'current\' => max( 1, get_query_var(\'paged\') ),
\'total\' => $the_query->max_num_pages
) );
?>
<?php endif; ?>
希望这有帮助:)