Custom Post Type Pagination
-
I am using custom post type that is hierarchical.
I have no trouble excluding children from the query by using:
parent=0This exclusion, however, doesn’t apply to the next_posts_link and previous_posts_link. I want to navigate using only the parent.
Here is my code:
<?php $showposts = new WP_Query('post_type=events&post_parent=0'); while($showposts->have_posts()) : $showposts->the_post(); ?> <?php the_title( '<h2><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h2>' ); ?> <div> <?php the_content(); ?> <p><?php next_post_link('%link', '« Newer Issue' ) ?></p> <p><?php previous_post_link('%link', 'Older Issue »') ?></> </div> <?php endwhile; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Custom Post Type Pagination’ is closed to new replies.