Skip to main content
2 of 3
added 200 characters in body
Jesse
  • 1k
  • 8
  • 12
foreach( $posts_array as $post ) {
        echo the_title();
}

I think the problem is you call the_title() without setup_postdata first

If I were you, I'll simply use $post->post_title.

foreach( $posts_array as $post ) {
        echo $post->post_title;
}

This is because you are "get_posts"ing within a loop, and setup_postdata will change global variable $post;

Jesse
  • 1k
  • 8
  • 12