• OK, this is strange because I’ve seen a lot of people posting the same question, but no clear answer. What I’m trying to do *should* be very simple – show only the most recent post (in it’s entirety) on my home page. Here’s what I’ve got going now that doesn’t work:

    <?php
    query_posts(array('showposts' => 1));
    get_header(); ?>
    <?php get_sidebar(); ?>
    <div id="content">
    <?php if(have_posts()) : ?>
    <?php while(have_posts()) : the_post(); ?>
    <div class="post">
    <h1 class="pageTitle"><?php the_title(); ?></h1>
    <h2 class="date"><?php the_time('F jS, Y') ?></h2>
    <?php the_content(); ?>
    </div>
    <?php endwhile; ?>
    <?php if (show_posts_nav()) : ?>
    <div class="pagination">
    <span class="prevlink"><?php next_posts_link('Older Posts'); ?></span>
    <span class="nextlink"><?php previous_posts_link('Newer Posts'); ?></span>
    </div>
    <?php endif; ?>
    <?php else : ?>
    <div class="post">
    <h1 class="pageTitle"><?php _e('Not Found'); ?></h1>
    </div>
    <?php endif; ?>
    </div>
    <?php get_footer(); ?>

    I’m still getting 10 posts on my home page.

    Any ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Only most recent post on home page’ is closed to new replies.