WordPress.org

Ready to get started?Download WordPress

Forums

WP-Paginate not fully working with custom post types (1 post)

  1. bencarter78
    Member
    Posted 2 years ago #

    Hi all

    Got a bit of a problem that I can't seem to work out. I'm using WP-Paginate to paginate my custom post types however, when I click on page 2 I get the same results.

    This is my code

    <?php get_header(); ?>
    
    <div class="grid_16">
    	<div id="page-content" class="clearfix">
    		<div class="content-padding">
    			<?php if ( have_posts() ) : ?>
    				<div class="">
    					<h1 class="page-title">
    						<?php
    							$term = get_term_by( 'slug', get_query_var( 'unit_area' ), get_query_var( 'taxonomy' ) );
    							echo $term->name . ' Units';
    						?>
    					</h1>
    				</div>
    				<?php $args = array( 'taxonomy' => 'unit_area', 'term' => $term->slug ); ?>
    				<?php query_posts( $args ); ?>
    
    				<?php while ( have_posts() ) : the_post(); ?>
    					<?php get_template_part( 'content', 'unit_area' ); ?>
    				<?php endwhile; ?>
    
    			<?php else : ?>
    
    				<div id="post-0" class="post no-results not-found">
    					<div class="entry-header">
    						<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
    					</div><!-- .entry-header -->
    
    					<div class="entry-content">
    						<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
    						<?php get_search_form(); ?>
    					</div><!-- .entry-content -->
    				</div><!-- #post-0 -->
    
    			<?php endif; ?>
    
    			<div id="page-nav">
    				<?php if(function_exists('wp_paginate')) { wp_paginate(); } ?>
    			</div>
    
    		</div><!-- .content-padding -->
    	</div><!-- #page-content -->
    </div><!-- .grid_16 -->

    Can someone assist me please?

Topic Closed

This topic has been closed to new replies.

About this Topic