0

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?

2 Answers 2

0

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:

0

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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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