• I have seen similar problems to this but I think mine is still unique as it happens no matter which pagi plugin I use.

    I have a custom post type which I query on a custom page. However when I click page two for example, the page is reloaded with the new URL indicating page two but the content stays the same. Even the pagination icons stay as they were with page one still highlighted.

    I have tried pagenavi and wp-paginate and also tried with and without reset query as well as deleting the previous loop that runs above my custom loop on the same page.

    See code below…

    <div class="left-wide">
    
    	<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    		<h1 style="margin-bottom: 18px;"><?php the_title(); ?></h1>
    		<?php the_content(); ?>
    	<?php endwhile; ?>
    
    	<?php wp_reset_query(); ?>
    
    	<?php $args=array(
    		'post_type' => 'employers',
    		'post_status' => 'publish',
    		'posts_per_page' => 10
    		);
    
    	// Create a new filtering function that will add our where clause to the query
    	function filter_where( $where = '' ) {
    	// posts in the last 30 days
    	$where .= " AND post_date > '" . date('Y-m-d', strtotime('-10 days')) . "'";
    	return $where;
    	}
    	add_filter( 'posts_where', 'filter_where' );
    
    	query_posts($args);
    	$i = 0; ?>
    	<?php if ( have_posts() ) while ( have_posts() ) : the_post();
    	if($i % 2){ $class = "even"; } else{ $class = "odd"; }
    	if($i == 0){ $class2 = "first"; } else{ $class2 = ""; }
    		$location = get_post_meta($post->ID, 'location', true); // GET CUSTOM FIELDS
    		$children = get_post_meta($post->ID, 'children_1', true); // GET CUSTOM FIELDS
    		$ages = get_post_meta($post->ID, 'ages', true); // GET CUSTOM FIELDS
    		$residence = get_post_meta($post->ID, 'type_of_residence', true); // GET CUSTOM FIELDS 
    
    	?>
    	<div class="listing <?php echo $class; ?> <?php echo $class2; ?>">
    		<ul><li class="full"><?php the_title(); ?></li><li class="short">Location: </li><li class="wide"><?php echo $location; ?></li></ul>
    		<ul><li class="short">Children: </li><li class="wide"><?php echo $children; ?></li></ul>
    		<ul><li class="short">Ages: </li><li class="wide"><?php echo $ages; ?></li></ul>
    		<ul><li class="short">Type of Residence: </li><li class="wide"><?php echo $residence; ?></li></ul>
    
    		<a href="<?php the_permalink(); ?>" class="listbutton"></a>
    
    	</div>
    	<?php $i = $i+1; ?>
    
    	<?php endwhile; ?>
    
    	<?php wp_pagenavi(); ?>
            <?php wp_reset_query(); ?>
    
    </div>

Viewing 1 replies (of 1 total)
  • I’m having the exact same problem using a page and page template as a static home page; however, on another page inside the site it’s working just fine for me.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom post type pagination – strange error’ is closed to new replies.