Title: List page posts error
Last modified: August 21, 2016

---

# List page posts error

 *  Resolved [Craig Jamieson](https://wordpress.org/support/users/digiguru/)
 * (@digiguru)
 * [12 years ago](https://wordpress.org/support/topic/list-page-posts-error/)
 * Hi
 * I have done several tutorials and followed many hacks and sometimes for a while
   it works and mostly it doesn’t work so I end up starting again. My list pages
   pagination don’t work when I go to the second page of list items. I get an error
   404.
 * My custom work.php page looks like this
 *     ```
       <?php 
   
       /*
   
       	Template Name: Work Page
   
       */
   
       get_header(); ?>
   
       <div id="content" class="clearfix">
   
       <?php
   
       $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
       $args = array( 'post_type' => 'work', 'paged'=> $paged ); $the_query = new WP_Query( $args ); ?>
   
       <h1><?php the_title(); ?></h1>
   
       <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
   
       <section class="post-content clearfix">
       <h4><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4>
       </section>
       					    <?php endwhile; ?>
   
       						        <nav class="wp-prev-next">
       							        <ul>
       					        	        <li class="prev-link left"><?php next_posts_link( 'Older Work', $the_query->max_num_pages ); ?></li>
       					        	        <li class="next-link right"><?php previous_posts_link( 'Newer Work' ); ?></li>
       							        </ul>
       					    	    </nav>
   
       					    <?php else : ?>
   
       	<p>There are no posts or pages here</p>
   
       <?php endif; ?>
       </div>
   
       <?php get_footer(); ?>
       ```
   
 * The page is [http://craigjamieson.com/work](http://craigjamieson.com/work) and
   it’s when you use the pagination below that it breaks when going to the next 
   10 posts.
 * Please advise, I have followed so many hacks and they keep breaking and I’m simply
   getting confused.
 * Thanks in advance 🙂
 * [https://wordpress.org/plugins/custom-post-type-ui/](https://wordpress.org/plugins/custom-post-type-ui/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [12 years ago](https://wordpress.org/support/topic/list-page-posts-error/#post-4927235)
 * Yeah, I know how you feel with this topic. Getting pagination to work with custom
   post types and custom loops can definitely be a pain. It’s also an issue that
   stems from WordPress core, as opposed to our plugin.
 * That said, is there any reason why you couldn’t use the generated archive for
   the post type, at least when you have it set to create archives. That may be 
   a better route to go, and it’d solve the pagination issue since the original 
   $wp_query would be based on the post type.
 *  Thread Starter [Craig Jamieson](https://wordpress.org/support/users/digiguru/)
 * (@digiguru)
 * [12 years ago](https://wordpress.org/support/topic/list-page-posts-error/#post-4927269)
 * Hi Michael
 * Thanks for the response. I thought I’d give your suggestion a try and went and
   set the archive to be true, but I don’t see how it works. I updated my functions
   file, but when I test, I don;t see any changes. I assume I’m doing something 
   wrong. Is there some sort of tutorial I could follow?
 * Thanks
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [12 years ago](https://wordpress.org/support/topic/list-page-posts-error/#post-4927282)
 * When going the archives route, you’ll have a url like [http://www.mydomain.com/post-type-slug](http://www.mydomain.com/post-type-slug)
   with “post-type-slug” being the actual slug you provided. I believe the archive
   will be interpreted before the page version, so it should kick in pretty quick.
 * Archives will rely on archive.php if you don’t have something more specific like
   archive-post-type-slug.php, and if you don’t have archive.php, it’ll go to index.
   php, if I recall my hierarchy correctly.
 * This method overall would eliminate the need to use a page to display the paginated
   archive.
 * Hopefully this is making sense

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘List page posts error’ is closed to new replies.

 * ![](https://ps.w.org/custom-post-type-ui/assets/icon-256x256.png?rev=2744389)
 * [Custom Post Type UI](https://wordpress.org/plugins/custom-post-type-ui/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-post-type-ui/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-post-type-ui/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-post-type-ui/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-post-type-ui/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-post-type-ui/reviews/)

## Tags

 * [error 404](https://wordpress.org/support/topic-tag/error-404/)
 * [pagination](https://wordpress.org/support/topic-tag/pagination/)

 * 3 replies
 * 2 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/list-page-posts-error/#post-4927282)
 * Status: resolved