• Resolved 000000000

    (@pealo86)


    The page I’m referring to is here:
    https://www.mattpealing-server.co.uk/~devfooty/hits-misses/

    I have the following page template (see the really simple query towards the bottom):

    <?php
    /**
     * @package WordPress
     * Template Name: Hits & Misses
     */
    ?>
    <?php get_header(); ?>
    
    	<div id="content" class="grid_9">
    
    		<div class="content">
    
    			<h1><?php the_title(); ?></h1>
    
    			<?php query_posts('post_type=hits-misses&paged=' . $paged); ?>
    				<?php get_template_part('loop', 'hits-misses'); ?>
    			<?php wp_reset_query(); ?>
    
    		</div>
    
    	</div><!--end content-->
    
    	<?php get_sidebar(); ?>
    <?php get_footer(); ?>

    and my loop template:

    <?php if(have_posts()) : ?>
    
    	<div id="feed-hits-misses" class="feed-hits-misses">
    		<div class="content">
    
    			<div class="feed">
    
    				<?php while(have_posts()) : the_post(); ?>
    
    					<section>
    						<?php if (has_post_thumbnail()) : ?>
    							<figure>
    								<a href="<?php the_permalink(); ?>"><img src="<?php echo getPostThumbnailUrl('feed-hits-misses'); ?>" alt="<?php the_title(); ?>" /></a>
    							</figure>
    						<?php endif; ?>
    
    						<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?> <span class="mark-2f81de">?</span></a></h3>
    					</section>
    
    				<?php endwhile; ?>
    
    			</div>
    
    			<?php get_template_part('include', 'paginate'); ?>
    
    		</div>
    	</div>
    
    <?php endif; ?>

    …and then there’s the template for the pagination:

    <div class="paginate">
    	<?php if (get_previous_posts_link()) : ?><span class="button button-prev"><?php previous_posts_link('Previous Page', 0); ?></span><?php endif; ?>
    	<?php if (get_next_posts_link()) : ?><span class="button button-next"><?php next_posts_link('Next Page', 0); ?></span><?php endif; ?>
    </div>

    However I am unable to use next / previous post links without getting a 404.

    I’ve had this problem many times in the past but have always been able to fix it by specifying the $paged variable within the search query. However this time it is refusing to work.

    Can anyone see what I’m doing wrong?

Viewing 1 replies (of 1 total)
  • Thread Starter 000000000

    (@pealo86)

    Spotted it, turns out the problem was caused by the fact I had a page name with the same name as a custom post type, both were called ‘hits-misses’

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Post Pagination Giving 404’ is closed to new replies.