Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Only 5 post are showing up on custom landing page

On "Creating a Portfolio Landing Page" Bootstrap to Wordpress - I followed the steps to display all of my custom posts but for some reason only 5 are showing up.

<?php $args = array( 'post_type' => 'movie_list', 'post_per_page' => 10 ); $the_query = new WP_Query( $args ); ?>

        <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

        <div class="col-sm-12">
            <h3><?php the_title(); ?></h3>
        </div>

<?php endwhile; endif; ?>

3 Answers

Daniel Stopka
Daniel Stopka
13,520 Points

Hi Christopher,

in $args 'post_per_page' should be 'posts_per_page'

Michael Guay
Michael Guay
5,297 Points

Check your functions.php file and make sure you're not limiting the amount of posts that are displayed there. If you can't find where that would be called - post the code here and we'll figure it out.

Side note, if you want only 10 then stick with the 10 you have set. if you want all of the posts the set the 'posts_per_page' to -1.