Creating a list of post like the index.php on a seperate page

Description

This code will allow you to query post for the entire blog and used on a custom page

This code will allow you to query post for the entire blog and used on a custom page

HTML Source Code

                        
                          <!-- Query all post starts-->
<?php 
// the query
$wpb_all_query = new WP_Query(array('post_type'=>'post', 'post_status'=>'publish', 'posts_per_page'=>-1)); ?>
<?php if ( $wpb_all_query->have_posts() ) : ?>

	<ul>
	<!-- the loop -->
	<?php while ( $wpb_all_query->have_posts() ) : $wpb_all_query->the_post(); ?>
	<!--Post HTML Starts-->		
			
		
		<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
				
				
				
	<!--Post HTML Ends-->				
	<?php endwhile; ?>
	<!-- end of the loop -->
	</ul>

<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
<!-- Query all post end-->                        
                        


Post Categories