Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I fetch external data like this, but I also added the_post();

while($slice = mysql_fetch_assoc($result)){
    the_post();
    rest of my stuff
}

I need a hook to tell me if the_post() returns true, something like this:

while($slice = mysql_fetch_assoc($result)){
    the_post();
    if(the post returs true){ do something;
    else { rest of my stuff }
}

Any ideas?

share|improve this question
    
what are you trying to determine exactly? the_post doesn't return anything. –  Milo Aug 3 '12 at 15:37

1 Answer 1

if you use the native wp_query to select posts instead of custom sql queries you can check against the have_posts() method of wp_query

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.