• I’m working on setting up processes for creating themes and have been downloading themes to checkout code styles and the way loops are used. I’ve found something that seems strange to me but maybe it’s just I haven’t had a need for it before. On some theme’s index.php files they start out with $wp_query = $tmp_query; and do not use $wp_query or $tmp_query anywhere during or after the loop. Now I’m going to take a stab at it’s usage. I’m thinking they are setting the value of $wp_query to null or an empty value, since $tmp_query hasn’t been assigned any value either. After setting the query to null they can populated the loop with other variables. Here is one of the loops.`<?php
    $wp_query = $tmp_query;
    if (have_posts()) :
    while (have_posts()) : the_post();
    $arc_year = get_the_time(‘Y’);
    $arc_month = get_the_time(‘m’);
    $arc_day = get_the_time(‘d’);
    ?><!– begin post –>
    <div class=”post”>

    <h2>“><?php the_title(); ?></h2>
    <p class=”details”>Posted by <?php the_author_posts_link(); ?> Filed Under <?php the_category(‘, ‘) ?> with <?php comments_popup_link(‘No Comments’, ‘1 Comment’, ‘% Comments’); ?></p>

    <div class=”content”>
    <?php the_content(‘Continue’); ?>
    </div>

    </div>
    <!– end post –>

    <?php endwhile; ?>
    <p class=”postnav”>
    <?php next_posts_link(‘« Older Entries’); ?>  
    <?php previous_posts_link(‘Newer Entries »’); ?>
    </p>
    <?php else : ?>
    <div class=”notfound”>
    <h2>Not Found</h2>
    <p>Sorry, but you are looking for something that is not here.</p>
    </div>
    <?php endif; ?>`
    Now within this loop I see no call to any of the variables set using the get_the_date() function. Can someone please break this down for me?

    Thanks much.

  • The topic ‘use of $wp_query’ is closed to new replies.