Forums

Help required to get pages to display properly (2 posts)

  1. Perad
    Member
    Posted 2 years ago #

    The code below creates a slider showing featured posts.

    I am trying to place this code into the page.php template file. I want this at the top of the page. The problem is that the slider creates a wp query in the template and thus when 'the loop' runs to retrieve the page that the user is visiting, it always return's the last featured post instead of the actual page. I assume this is because the_post variable is being overwritten with the query_posts function?

    How do I query the db after the slider to retrieve that actual page the user is on?

    <?php if($featured_entries != 1){ ?>
    <?php query_posts( 'showposts='.$featured_entries.'&cat=' . $featured_category); ?>
    
    <div class="bottompanel">
    	<div id="moduleslider2-size">
    		<div id="moduleslide2">
    			<?php $id = 1; ?>
    			<?php while (have_posts()) : the_post(); ?>
    			<div class="tab-pane box" id="tab-<?php echo $id; ?>-pane">
    				<h1 class="tab-title"><span>Popular Posts</span></h1>
    				<div class="feature-post2">
    					<div class="text">
    						<h1><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>
    						<div class="smallnews" style="height:70px; overflow:hidden;">
    							<?php the_excerpt(); ?>
    						</div>
    					</div>
    				</div>
    			</div>
    			<?php $id ++; endwhile; ?>			
    
    		</div>
    	</div>
    </div>
    
    <?php } else { ?>
    <div class="bottompanel"></div>
    <?php } ?>
  2. alchymyth
    The Sweeper
    Posted 2 years ago #

    <?php wp_reset_query(); ?>

    and maybe:

    <?php rewind_posts(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.