Wrapped references to $post in if statements.