• I created a custom post type to keep track of directory listings for a website. There are hundred of listings, and I only want to show 10 per page. How can I add a next page or previous page for this custom post type?

Viewing 1 replies (of 1 total)
  • With the TwentyTen theme I created a Page called Books, then utilized a Page Template called Page of Books and have it paginating to two books per page.

    <?php
    /**
     * Template Name: Page of Books
     *
     * Selectable from a dropdown menu on the edit page screen.
     */
    ?>
    
    <?php get_header(); ?>
    
    		<div id="container">
    			<div id="content">
    <?php
    $type = 'book';
    $args=array(
      'post_type' => $type,
      'post_status' => 'publish',
      'paged' => $paged,
      'posts_per_page' => 2,
      'caller_get_posts'=> 1
    );
    $temp = $wp_query;  // assign orginal query to temp variable for later use
    $wp_query = null;
    $wp_query = new WP_Query($args);
    ?>
    
    <?php
    
     get_template_part( 'loop', 'index' );?>
    			</div><!-- #content -->
    		</div><!-- #container -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Pagination with custom post type’ is closed to new replies.