• My conditional tags work right in the header, on the various content pages, but not in the footer. If I’m on a page and I just run a simple test like:


    <?php
    if ( is_page() )
    echo "It's a page!";
    ?>

    It will echo correctly if I put it in the header or in the content area, but it won’t in the footer. Eventually I figured out it’s registering is_home(). For some reason on a page, the footer thinks it’s actually the home page. The footer correctly displays other conditional tags though, for instance, when it’s a search page the footer registers is_search().

    Anyone know what might be the problem?

Viewing 1 replies (of 1 total)
  • Thread Starter mixmanner

    (@mixmanner)

    Well, I know why it’s doing it, I think. All the conditional tags are based off of the query. If you query a page_id it think it’s a page, if you query a post it thinks it’s a single. I guess that kind of makes sense, but what if somebody wants to have a custom query on a page, then conditional tags won’t work after the query. Or is there some way that I missed?

Viewing 1 replies (of 1 total)

The topic ‘Conditional tags misbehaving’ is closed to new replies.