• 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)
  • admin – settings – reading
    set it to 1

    Thread Starter tactics

    (@tactics)

    Then it sets all the pages to only one. I want my categories pages to have ten. I just want my home page to have one.

    Hi,
    You can use this plugin. http://www.maxblogpress.com/plugins/dppp/use/ I’m on wp 2.7 and it works perfectly. Don’t be stopped by the installation process- you’ll need to registered. After it does excatly what you was asking for.

    Thread Starter tactics

    (@tactics)

    I’ll check it out, thanks.

    In the meantime, I managed to get it to work by creating a “home.php” page and using this:

    <?php query_posts('showposts=1&amp;cat=0'); global $more; $more = 0; while (have_posts()) : the_post(); ?>

    That retrieves the latest post from category number 0

    how is the code working for you? I was searching for the exact same thing. Thanks for the info.

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