Generating WP Posts in a page

WP Posts in One Page

My example is here:

Have you ever wanted to create a page that just lists all your posts on one page?  This can be done and is nice in case you want people to see all the posts you have created in one long list and formatted the way you want to.

The Code

If you ever want to list like this so that people can do this here is some code to help you do this:

[wpex more=”See Code” less=”Collapse”]

$wpb_all_query = new WP_Query(array(‘post_type’=>’post’, ‘post_status’=>’publish’, ‘posts_per_page’=>-1)); ?>

<?php if ( $wpb_all_query->have_posts() ) : ?>
<!– the loop –>
<?php while ( $wpb_all_query->have_posts() ) : $wpb_all_query->the_post(); ?>

——————————————————– Your Code Here ——————————————————–

<?php endwhile; ?> <?php endwhile; ?>    <!– end of the loop –>
<?php wp_reset_postdata(); ?> <?php else : ?>    <p><?php _e( ‘Sorry, no posts matched your criteria.’ ); ?></p><?php endif; ?>


Best Wishes Out There

Hope you are all doing well and feel free to get ahold of me if you need any help with any web programs, creating sites to help you  sell products, write about yourself or promote yourself.  Hope you are all doing well and take care out there.

%d bloggers like this: