• Resolved Andrew

    (@schmitt)


    I’ve searched the archives and can’t assemble a complete picture. A number of people have asked about this.

    It is clear that using query_posts() messes up any subsequent use of conditional tags in 2.3.2 WordPress – any dissension here?

    Maybe this is by design but regardless it is impacting the functionality of my sidebar.

    This is what I am using now on an archive Page that simply displays all posts except those from one category.

    <?php if (is_page()) {
    
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 0;
    query_posts("cat=-3&posts_per_page=50&paged=$paged");
    
    global $more;
    // set $more to 0 in order to only get the first part of the post
    $more = 0; 
    
    ?>

    I found the $more = 0 in the codex. It forces the more tag to be respected in the loop.

    Any call to conditional tags afterwards is_home, is_archive, is_page don’t yield the expected results.

    I’m looking to understand the following:

    • What values are returned for the is_home, is_archive, is_page, is_single, is_tag.
    • How do I manually force a conditional tag setting, much like the $more hack?
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Andrew

    (@schmitt)

    What is really confusing is it appears is_archive returns a ‘false’ and is_home returns a ‘true’.

    What values are returned for the is_home, is_archive, is_page, is_single, is_tag.

    1 (true) or 0 (false).

    How do I manually force a conditional tag setting, much like the $more hack?

    They are part of the $wp_query object, so examples:

    $wp_query->is_home = true;
    $wp_query->is_category = false;

    Thread Starter Andrew

    (@schmitt)

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Force Conditional Tags – query_posts’ is closed to new replies.