[resolved] Pagination issues on Custom Post Types - 404 pages (2 posts)

  1. nadine00
    Posted 4 years ago #


    So I can't seem to get pagination to work on my templates and its making me batty. I have a piece of code I've used for ages with no issues except for now, it seems to not work with post-types. I get a 404 error when i try to go to page two.

    Any suggestions?

    		// pagination
    		$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    		// query
    		$listings = array(
    		'post_type' => 'event_listing',
    		'meta_key' => 'tf_events_startdate',
    		'orderby' => 'meta_value',
    		'order' => 'DESC',
    		'posts_per_page' => 2,
    		'paged' =>$paged
    	<?php query_posts($listings); ?>
    	<?php if (have_posts()) : while (have_posts()) : the_post();?>
    <?php the_title();?>
    <?php endwhile; else: ?>
    	 <p><strong><?php include('inc/nope.php');?></strong></p>
    	<?php endif; ?>
    	<div class="postNavigation clearfix">
    	 <p class="postNavL"><?php next_posts_link('« Older Entries') ?></p><p class="postNavR"><?php previous_posts_link('Newer Entries »') ?></p>
    	</div> <!-- end .postnavigation -->
    <?php wp_reset_query(); ?>
  2. nadine00
    Posted 4 years ago #

    Found a solution. Set the read settings to 1 in the admin. While this isn't the best all round solution. I'm making a stripped down admin where users don't have access to reading settings. So it works in this scenario:


Topic Closed

This topic has been closed to new replies.

About this Topic