WP_Query and Pagination
-
I am using WP_Query to call posts from a specific category as shown in the code below. How do I add pagination to show the rest of the posts from this category?
<?php get_header(); ?> <?php //get 4 recent posts for category 3 $args=array( 'category__in' => array(3), 'showposts'=>4, 'caller_get_posts'=>1 ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <div class="recvidimgborder"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><img src="<?php video_thumbnail(); ?>" class="recvidimg" /></a> </div> <?php endwhile; } //if ($my_query) wp_reset_query(); // Restore global post data stomped by the_post(). ?> <div style="clear:both;"></div><br /><br /><?php get_footer(); ?>
- The topic ‘WP_Query and Pagination’ is closed to new replies.