Support » Themes and Templates » Where to place a query to show only one post

  • I cannot seem to figure out where to place the query to show only one post in my home.php file. The template I am using uses this file for the home page. Here is the code:

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="fullbox" id="post-<?php the_ID(); ?>">
    <h3><?php the_category(', ') ?></h3>
    <div class="fullbox_content">
    <h1><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>

    Any help would be appreciated!

Viewing 1 replies (of 1 total)
  • right infront of your code:

    <?php global $query_string;
    query_posts($query_string . "&posts_per_page=1"); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    //and so on//

Viewing 1 replies (of 1 total)
  • The topic ‘Where to place a query to show only one post’ is closed to new replies.