Skip to main content
added 200 characters in body
Source Link
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;$post which is set with the current post's information while The Loop is running.

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;

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 which is set with the current post's information while The Loop is running.

added 200 characters in body
Source Link
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;

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

Source Link
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.