WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to make the code below preview a page instead of a latest category post?

<div class="one_third_last">
  <h2>Gift Vouchers</h2>
  <div class="entry">   
//The Query
//The Loop
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
   <?php if ( has_post_thumbnail()) the_post_thumbnail('medium-thumbnail'); ?>
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><small><?php the_time('F jS, Y') ?></small></a>
  <p><a rel="bookmark" href="<?php the_permalink(); ?>"><?php echo strip_tags(get_the_excerpt());?></a></p> 
<?php endwhile; else: ?>
    <p>Sorry, no posts matched your criteria.</p>
<?php endif;
//Reset Query


share|improve this question
up vote 0 down vote accepted

try and change this line:






(enter the actual page ID or page slug into the respective space)


share|improve this answer
Awesome! thanks Michael that did the trick. – Nsokyi Oct 15 '11 at 14:26
No need for the posts_per_page argument, i very much doubt you'll get more than one result when querying by a specific page ID... ;) – Mark Duncan Oct 15 '11 at 16:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.