• Hi, I have a sidebar before my actual page content that do a wp_query. The question is how to reset to the original query of the page so that after that wp_query it shows correctly. I.e.

    <?php
    	global $query_string;
    	$temp_string = $query_string;
    	echo $query_string;
    ?>
    <div class="sidebar">
    	<div class="block">
    		<h5>Recent Post</h5>
    		<ul class="recent">
    			<?php
    				$recent = new WP_Query("showposts=7&order=DESC&category_name=Journal");
    				while($recent->have_posts()):
    					$recent->the_post();
    					echo '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>';
    				endwhile;
    			?>
    		</ul>
    	</div><!-- end of block -->
    </div><!-- end of sidebar -->
    <?php
    	$query_string = $temp_string;
    	query_posts($query_string);
    ?>

    and on the content I have:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?ptp the_title();?>
    <?php endwhile; endif; ?>

    As you can see i’ve tried saving the query string, but it turns out that the showposts is not saved and it gets the value from the custom wp_query, and there is no way for me to know what value I need as the sidebar is used on the single posts pages as well as on the archive pages..

    Can anyone help me out…

    Thanks beforehand

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Multiple Loops help’ is closed to new replies.