Below is the code from my author.php file. The problem is that
previous_posts_link only generate links based on the number of posts in the blog authored by the author in question, not the number of posts in the query ( which includes pages and events). I have used WP_Query to add the custom post type 'events' as recommended here. I find this behaviour strange because the page is displaying the results of the query but the
previous/next_posts_link's are doing something completely different. Can anyone see my mistake or is this some problem with WordPress.
<?php get_header(); // add evemts post type to query $query = new WP_Query( array( 'post_type' => array( 'post', 'page', 'events' ) )); if($query->have_posts()) : ?> <h2 class="title">Posted by : author </h2> <div id="main"> <div id="content"> <?php while($query->have_posts()) : $query->the_post(); ?> <div class="archive-post" id="<?php the_ID(); ?>"> <div class="blog-entry"> <h3 class="blog-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <div class="entry-meta">Entry meta here</div> <?php the_excerpt(); ?> <div class="entry-utility"> <?php edit_post_link( 'Edit', '<span class="edit-link">', '</span>' ); ?> </div> </div> </div> <!-- .post --> <?php endwhile; endif; ?> <!-- navigation --> <div class="navigation clear"> <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div> </div> </div> <!-- end #content --> <?php get_sidebar(); ?> </div><!-- #main --> <?php get_footer(); ?>
EDIT : I have just found this page detailing the problem, however after implementing the solution, while it is definitely an improvement in that the links now show, still for some reason they point me to a 404 page