Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am new to the world of WordPress. I own a new site and I'd like my home page to display the latest news and articles (which I accomplished to set in Settings > Reading), but I'd like another page to display all posts (not the whole post but a summary) without the need to press "previous page".

e.x. If I have 8 posts and I set maximum posts to be 4 in the settings menu, my home will have 4 posts. But I'd like the other page to have all 8 posts in summary without the need to press previous page to read other posts. How can that be done?

share|improve this question

migrated from stackoverflow.com Jul 15 '13 at 14:37

This question came from our site for professional and enthusiast programmers.

2 Answers 2

Something along the lines of

<?php
    if(have_posts()) {
        while(have_posts()) {
            the_post(); the_excerpt();
        }
    }
?>

And of course, read the documentation for further info:

share|improve this answer

You have to run a custom loop. Create a new template file and in that template file you must run a custom loop like this:

 <?php
 $args = array(
     'post_type' => 'post'
     'posts_per_page' => -1 //setting -1 will return all posts
 );

 //query for our posts
 $posts = new WP_Query( $args );

 //if we have posts, loop them
 if( $posts->have_posts() ): while( $posts->have_posts() ): $posts->the_post(); ?>
         //your html here
         <h2><?php the_title(); ?></h2>
         <p><?php the_content(); ?></p>

 <?php
 endwhile;
 endif;

 //even though WP_Query doesn't effect the main loop, reset it as precaution
 wp_reset_query();
 ?>

Unfortunately it isn't easy to do this without creating a custom template file but you can find all the resources you need to piece this together. Best of luck!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.