Else statement not triggering after a failed if statement

I can’t see a problem with your if-else-statement, so I’m thinking the problem origins somewhere else. You say you get no errors, I guess you have debugging enabled. Besides, did you debug and inspect – var_dump or print_r it – the $wp_query object, to see if it is really empty, has no posts.

Another thing, you are using query_posts(), which you shouldn’t. I don’t want to replicate the argument for that, so see those two questions for more information:

This should clear now, better use pre_get_posts or WP_Query or get_posts.

One more remark, you are using:

  • 'post' => 'ID'

in your arguments array, but post isn’t a valid parameter – see this question for more information.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)