Custom Postype Query showing only 10 results should show 23 results

This is the code I have currently on my development site. It only shows 10 results from custom post type “pacificheritage” but it should show 23 all together.

<?php                   
          global $post;
          $i=1;
          $args = array(
             'order' => 'ASC',
             'orderby' => 'post_date',
             'post_status' => 'publish',
             'post_type' => 'pacificheritage'
          );
      ?>    
      <?php if (have_posts()):?>
                <?php
                $list_of_posts = new WP_Query($args); 
                while ($list_of_posts->have_posts()):$list_of_posts->the_post();
                $meta = get_post_meta( get_the_ID(), '');
                ?>
                <?php echo $post->ID; ?>
                <?php the_title(); ?><br/>
            <?php 
                endwhile;
                wp_reset_query();
                endif; 
            ?>

Related posts

2 comments

  1. You need to add ‘posts_per_page’=>’-1′ to $args, so:

    <?php                   
          global $post;
          $i=1;
          $args = array(
             'order' => 'ASC',
             'orderby' => 'post_date',
             'post_status' => 'publish',
             'post_type' => 'pacificheritage',
             'posts_per_page'=>'-1'
          );
      ?>    
      <?php if (have_posts()):?>
                <?php
                $list_of_posts = new WP_Query($args); 
                while ($list_of_posts->have_posts()):$list_of_posts->the_post();
                $meta = get_post_meta( get_the_ID(), '');
                ?>
                <?php echo $post->ID; ?>
                <?php the_title(); ?><br/>
            <?php 
                endwhile;
                wp_reset_query();
                endif; 
            ?>
    

Comments are closed.