WordPress setup_postdata()
Web Design & IT Services in Swanage, Poole, Bournemouth and Dorset by Matthew Pond
Tags
You must use $post and global $post.
global $post;
$args = array( 'numberposts' => 5, 'offset'=> 1, 'category' => 1 );
$myposts = get_posts( $args );
foreach( $myposts as $post ){
setup_postdata($post);
echo the_title();
}
wp_reset_postdata();