WordPress.org

Ready to get started?Download WordPress

Forums

is_page thinks is_archive (3 posts)

  1. trevorhughdavis
    Member
    Posted 8 years ago #

    why does my wordpress think my pages are archives? I tried updating permalinks, i tried all kindsa stuff, but the wp_query doesn't think its a page, it thinks its an archive.

    the weird thing is that some pages work. '

    just new ones don't

    i am confused.

    Here is the var_dump($wp_query) if this helps:

    ---

    object(WP_Query)#26 (24) {
    ["post_count"]=>
    int(0)
    ["current_post"]=>
    int(-1)
    ["post"]=>
    NULL
    ["is_single"]=>
    bool(false)
    ["is_page"]=>
    bool(false)
    ["is_archive"]=>
    bool(true)
    ["is_date"]=>
    bool(false)
    ["is_year"]=>
    bool(false)
    ["is_month"]=>
    bool(false)
    ["is_day"]=>
    bool(false)
    ["is_time"]=>
    bool(false)
    ["is_author"]=>
    bool(false)
    ["is_category"]=>
    bool(true)
    ["is_search"]=>
    bool(false)
    ["is_feed"]=>
    bool(false)
    ["is_trackback"]=>
    bool(false)
    ["is_home"]=>
    bool(false)
    ["is_404"]=>
    bool(true)
    ["is_comments_popup"]=>
    bool(false)
    ["is_admin"]=>
    bool(false)
    ["is_paged"]=>
    bool(false)
    ["query"]=>
    string(27) "category_name=contact-us%2F"
    ["query_vars"]=>
    array(7) {
    ["category_name"]=>
    string(10) "contact-us"
    ["posts_per_page"]=>
    string(1) "5"
    ["what_to_show"]=>
    string(5) "posts"
    ["nopaging"]=>
    bool(false)
    ["cat"]=>
    NULL
    ["order"]=>
    string(4) "DESC"
    ["orderby"]=>
    string(9) "date DESC"
    }
    ["posts"]=>
    &NULL
    }

    ----

  2. Joshua Sigar
    Member
    Posted 8 years ago #

    Do you embed custom query_posts? Like pulling out posts with category name "contact-us?" By doing so, your page is in category-view mode (is_category is true). When in category view, automatically the page is in archive mode also.

    So, basically the page is a "page" by the original, behind-the-scene query_posts, until you call another query_posts which override the type of the page to become an "archive"

  3. trevorhughdavis
    Member
    Posted 8 years ago #

    i don't think there is... i have used them in the past...but not in this template.

    I'm sorry, I don't quite know what to do... does that mean that i call another query object at the top of my template?

    i mean, i'm using the is_page to detect if the page is a page or not.

    so i can't just override it for everything. kinda defeats the point.

    here is my template. i cut and pasted the sidebar and header and footer into it so it would all be one file.

    ____

    [Moderated: long code deleted]
    Please, use http://pastebin.com or similar services to post code

Topic Closed

This topic has been closed to new replies.

About this Topic