Support » Themes and Templates » custom page template querying custom post type pagination not working

  • I have a page template querying a custom post type that I’m trying to set up pagination on. My permalink settings is set to Postname (/%postname%/). But the pagination links don’t show up. I’ve gone through a bunch of the codex and I’m at a loss. Below is an oversimplified version of what I’m going for and it still doesn’t show the pagination links. Thanks for your help!

    <?php
    */
    * Template Name: Artworks Index
    */
    
    get_header();
    
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    $the_query = new WP_Query(array(
    	'post_type' => 'artpress_artwork',
    	'paged' => $paged,
    	'posts_per_page' => 5,
    ));
    
    if($the_query->have_posts()):
    ?>
    <div class="artworksIndex">
    	<h2 class="artworksIndex-title">Our Artworks</h2>
    	<div class="artworksIndex-artists">
    	<?php while($the_query->have_posts()):
    		$the_query->the_post();
    		the_title();
    	endwhile; ?>
    	</div>
    </div>
    <div class="clear--both"></div>
    <div class="pagination">
    	<span class="pagination-prev"><?php next_posts_link('<< Prev') ?></span>
    	<span class="pagination-next"><?php previous_posts_link('Next >>') ?></span>
    </div>
    <?php 
    
    endif;
    get_footer();
    
    ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘custom page template querying custom post type pagination not working’ is closed to new replies.