WP_Query says "Call to a member function have_posts() on a non-object"
-
Hi,
I have this weird error when trying to make a simple WP_Query. Maybe there is something evident that I am missing but I can’t see it.. Here is my code, it is all there is in the page, beside header.php and footer.php obviously..
// Black Boxes (there is 2) $pages = new WP_Query( array( 'post_type' => 'page', 'post__in' => array( 23, 21 ) ) ); if ( ! $pages->have_posts() ) : endif; while( $pages->have_posts() ) : $pages->the_post(); the_title(); endwhile; // Prevent weirdness wp_reset_query();
Thanks!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘WP_Query says "Call to a member function have_posts() on a non-object"’ is closed to new replies.