How to get WordPress posts outside the loop

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;
?>

Related posts:

HTML5 page structure

HTML5 offers more powerful structure comparing to older versions of Html. There are many new …


Partner with Us

We are providing an exclusive partnership offer to individuals and companies who are interested in setting up their own web design & development company. For more information about how to partner with us, please contact us