Good point about the examples used! I had actually taken some ideas from http://codex.wordpress.org/The_Loop_in_Action – to try and check if there’s post first and then do something on the basis of the result.
Thanks for your help. I’ve taken get_posts() outside the if statement and that did work. I guess I am confused because both pages are OUTSIDE WordPress and since it is the same code, I wasn’t sure why it worked on one page and not the other.
Dantina
Hi Heavox,
Thanks for your response but I am assuming the have_posts() function is supposed to check if there’s any post using some in-built query; that way, you could do something else if there’s no post. I am following the instructions here: http://codex.wordpress.org/Integrating_Wordpress_with_Your_Website – which uses the codes in the same way to get posts from outside WP environment.
Besides, I am doing exactly the same thing on the other page and it works, so I don’t think that’s the problem.
Dantina