Pagination with custom post type listing
-
I am fairly new to wordpress and a total PHP newbie… What I want to be able to do is display 9 post thumbnails from a custom post type, and have a pager at the bottom. Here is an excerpt of my template code:
<div id="content" role="main" class="entry-content"> <?php $loop = new WP_Query( array( 'post_type' => 'accessories', 'posts_per_page' => 9, 'orderby'=> menu_order) ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class="accessory_image"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail(array(200,160)); } ?></a> <?php the_title( '<h3 class="accessory-title"><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h3>' ); ?> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php previous_posts_link('« Previous') ?></div> <div class="alignright"><?php next_posts_link('More »') ?></div>
The “more” and “previous” links are there, and the “more” link does point to “our_accessories/page/2” (I realized I couldn’t name the page the same as the content type)
But the same items show on each page.
Anyone have any insight?
Thanks!!
Dani
- The topic ‘Pagination with custom post type listing’ is closed to new replies.