The following test code was working fine up to 2.3.3 but when I upgraded to 2.5 it stopped working. Specifically, it returns nothing, meaning there are no errors but no posts come back either, when it should display titles of the posts!
<?php
require('wp-blog-header.php');
if (have_posts()) : while (have_posts()) : the_post();
the_title();
endwhile; else:
endif;
?>
I don't know what happened since there are no errors coming back!!!
Okay, just so I know I'm not crazy, try this piece of code:
<?php
require('wp-blog-header.php');
$myid=10; //put a post id here that you know is valid
$mytest = get_post($myid);
echo "Known good post id ".$myid." returns: ".$mytest->post_title;
$mytest = have_posts();
if ($mytest=="") { $mytest="nothing"; }
echo " and have_posts() returns: ".$mytest;
?>
If you stick a Post ID number in that you know is valid, it will correctly display the title, yet the have_posts() returns empty!
Any suggestions anybody?