Inspiration For Creative Minds
Home » Labs » How to get WordPress posts outside the loop  

Filed under Labs

Add below PHP code to your WordPress template where you want to show the posts and it will display WP posts outside the loop.

 
 
<?php
	$outside_posts = get_posts('numberposts=10&orderby=post_name');
	foreach($outside_posts as $post) : setup_postdata($post);
?>
 
<? 
	the_title();
	the_content();
?>
 
<?php
	endforeach;
?>
It's only fair to share...Share on Google+Tweet about this on TwitterShare on Facebook
Labs

Posts you may like: