Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
adding 'posts_per_page' breaks my site.
When I add 'posts_per_page' to the $args array, my top menu disappears, as well as all my image posts.
When I remove 'posts_per_page', my site works fine and all images appear. Why is this??
<?php $args = array( 'post_type' => 'portfoliopost' 'posts_per_page' => 4 ); $query = new WP_Query( $args ); ?>
Joel Bardsley31,245 Points
You're missing a comma at the end of 'post_type' => 'portfoliopost'
If you don't have error reporting turned on, it might be useful for you (in your development site only). You can do this by editing the wp_config.php file in your root wordpress folder and changing define( 'WP_DEBUG', false ); from false to true.
Well thats embarrassing! Thanks man. and thanks for the error reporting tip!