query_post Impacts is_page() ?
-
I have a page (not post) that I’m creating on my site. The purpose of that page is to display three “blocks”, each with a list of the 10 most recent posts in a specific category.
So I created a template specifically for that page. In the template I use get_header() to grab the top of my site. Then I use the query_posts function and the rewind_posts function to create each “block”. So far so good, all of this works as intended.
However at the bottom of the page I want to do something special if the user is looking at that any page (not post). The bottom is built using the get_footer() function. In my footer template I have an if statement that checks to see if we are looking at a page with the is_page function.
The is_page function seems to break when I have used the query_posts function in the page template. If I just use a regular Loop without any query_post function the footer correctly identifies the page as a page via the is_page function and it does what I want.
However as soon as I use the query_post function on a page, the is_page function no longer returns true. Is there something I’m missing? After I enter The Loop for the last time in the page template I’ve tried calling rewind_posts again thinking that perhaps something needed to be reset, however is_page still evaluates to false when viewing that page.
- The topic ‘query_post Impacts is_page() ?’ is closed to new replies.