Add pagination to WP_Query (posts by tags)
-
How do i add pagination to this.. i tried it my self but nothing works for me.. the pagination isn’t showing..
<?php $args=array( 'tag' => gtags_get_group_tags(), 'caller_get_posts'=>1, 'posts_per_page'=>3 ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <!--- my post list ---> <?php endwhile; $big = 999999999; // need an unlikely integer echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $wp_query->max_num_pages ) ); } //if ($my_query) wp_reset_query(); ?>
- The topic ‘Add pagination to WP_Query (posts by tags)’ is closed to new replies.