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 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 🙂
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘List page posts error’ is closed to new replies.