When you need pagination on a page (rather than an archive), you may want to introduce pagination.
Incorporate it into your query by detecting the page and modifying your query accordingly:
<?php $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'event', 'posts_per_page' => 6, 'paged' => $paged ); // The Query $the_query = new WP_Query( $args ); ?> |
Then, spit out the actual pagination:
<?php $prev_arrow = is_rtl() ? '<span class="arrow-right"></span><span class="direction-text">Next</span>' : '<span class="arrow-left"></span><span class="direction-text">Prev</span>'; $next_arrow = is_rtl() ? '<span class="arrow-left"></span><span class="direction-text">Prev</span> ' : '<span class="arrow-right"></span><span class="direction-text">Next</span> '; $total = $the_query->max_num_pages; $big = 999999999; // need an unlikely integer if( $total > 1 ) { if( !$current_page = get_query_var('paged') ) $current_page = 1; if( get_option('permalink_structure') ) { $format = 'page/%#%/'; } else { $format = '&paged=%#%'; } echo paginate_links(array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => $format, 'current' => max( 1, get_query_var('paged') ), 'total' => $total, 'mid_size' => 3, 'type' => 'list', 'prev_text' => $prev_arrow, 'next_text' => $next_arrow, )); } } ?> |