I am having trouble running query_posts when my page loads for the first time, i.e Session is empty.
When the page loads for the first time and the SESSION is empty, the following code runs:
<?php
$id = 106;
if ((empty($_SESSION['r1']))){
echo "This Line Prints";
query_posts("cat=-.'$id'&".$query_string);
wp_reset_query();
echo "This Line also Prints";
}
?>
The two statements mentioned in the above code are printing but the query_posts is not running here. However when I am running it outside the session it is working fine :S How can I run this query_posts if the Session is empty? Why doesn't this code work?
wp_reset_query()right after you runquery_posts(); so how do you know thatquery_posts()isn't running, and simply being reset? – Chip Bennett Feb 8 '12 at 17:29$id? also- remove the dot and single quotes around $id. – Milo Feb 8 '12 at 17:55