setup_postdata not working code example
Example: setup_postdata not working
global $post; //important
$posts = get_posts($args);
foreach($posts as $post) { //should be $post not $p etc
setup_postdata($post);
the_title();
}
wp_reset_postdata();