Archive template for custom post type only lists first 10

Here is my template for archive-people.com:

It currently only shows the first 10 people. I’d like it to show everyone, not just the first 10 people.

Read More
<?php get_header(); ?>
<div id="content" class="clearfix row-fluid">
<div id="main" class="span12 clearfix" role="main">
    <?php if ( have_posts() ) : while (have_posts()) : the_post(); ?>
    <div class="person-card">
        <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
            <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'thumbnail' ); ?><br />
            <?php the_title(); ?></a>
        </div>
    </div>
    <?php 
        endwhile; 
        endif;
    ?>
</div>
</div>
<?php get_footer(); ?>

If I want it to display everyone, is that something I change in the template? Or is that something that I add to the functions.php file?

Related posts

1 comment

  1. In function.php

    add_action('pre_get_posts','show_all_people');
    
    function show_all_people( $query ) {
      if ( $query->is_main_query() && is_post_type_archive('people') ) {
        $query->set('posts_per_page', -1);
      }
    }
    

    See Codex docs for pre_get_posts hook

Comments are closed.