Pagination in WP_Query?
-
I am using a WP_Query to display posts from within a category and a custom term selected (“fitness visibility” inside category “articles”)
My code:
<?php $catquery = new WP_Query( 'post_type=article&posts_per_page=4&article-visibility=fitness' ); while($catquery->have_posts()) : $catquery->the_post(); ?> <article class="post home-post"> <a href="<?php the_permalink(); ?>"> <div class="post-thumbnail-img"> <?php the_post_thumbnail('small-thumbnail'); ?> </div> <h2><?php the_title(); ?></h2> </a> <p class="post-info"> <?php the_time('F jS, Y'); ?> | <?php get_template_part('block-athlete-archive'); ?> </p> <p> <?php echo get_the_excerpt(); ?> <span class="readmore"> <br><a href="<?php the_permalink(); ?>">Read more »</a> </span> </p> </article> <?php endwhile; ?>
Now on my archive pages I use this code for pagination:
<div class="pagination"> <?php wpex_pagination(); ?> </div>
I put it after my “endwhile” and it works.
This is not the case for the WP_Query.
How do I solve this?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Pagination in WP_Query?’ is closed to new replies.