resetting “the_title”
-
I’m sure this is a very simple php issue – but my skills are limited and I wanted to see if someone could guide me in the right direction.
I have a page where I want to display “the title” of the page at the top, then run a query to pull three posts from a given category and then display “the title” of the page again.
The title displays perfectly the first time, then after the query to display the 3 posts runs the title displays ast the title of the last post in the query. How do I reset my query so that when I request the title a second time it is the actual title of the page?
Here is my basic code:
<?php the_title(); ?> <!-- feature/banner container starts --> <div class="banner"> <div class="img_container"> <img id="large_gallery_image" src="" alt=""/> </div> <ul class="thumb_img" id="thumb_gallery_images"> <?php $the_query = new WP_Query('category_name=hq-feature&showposts=4'); $i=1; while ($the_query->have_posts()) : $the_query->the_post(); $do_not_duplicate = $post->ID; ?> <!-- <li><?php get_the_image( "custom_key=featureThumb&default_size=thumbnail&width=44&image_class=attachment-thumbnail&default_image=$default_thumb" ); ?></li>--> <li><a href="javascript:void(0)" rel="img<?php echo "$i"; ?>.jpg"><img src="<?php bloginfo('template_directory'); ?>/includes/images/thumb<?php echo "$i"; ?>.jpg" alt="img<?php echo "$i"; ?>" /></a></li> <?php $i++; endwhile; ?> </ul> </div> <div id="gallery_image_text_container" class="details"> <?php $the_query = new WP_Query('category_name=hq-feature&showposts=4'); $i=1; while ($the_query->have_posts()) : $the_query->the_post(); $do_not_duplicate = $post->ID; ?> <div class="img<?php echo "$i"; ?>"> <h3><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3> <p><strong><?php echo strip_tags(get_the_excerpt(), '<a><strong>'); ?></strong></p> <!--<p>...<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Read More</a></p>--> </div> <?php $i++; endwhile; ?> </div> <?php the_title(); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘resetting “the_title”’ is closed to new replies.