• Resolved neilcreek

    (@neilcreek)


    I would like to display a single post on the front page, but more ont all other pages, such as categories,search results and archives. When I select “show at most” x posts in the settings, this applies to all pages.

    Any suggestions?

    Thanks for the help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Could use the showposts=1 parameter with the Template Tag, query_posts.

    Thread Starter neilcreek

    (@neilcreek)

    Beautiful! That did just the trick, thank you!

    I’m at a loss as to how to implement this on my own site. I’ve entered:

    <?php
       if (is_home()) {
          query_posts("showposts=1");
       }
    ?>

    before these lines:

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    And the result is that it restricts the first page of my site to the last entry – which is good. But when I click on the “Older Entries” link, all I get is the same single post again, over and over. Nothing else appears.

    If I place that If statement like so:

    <?php if (have_posts()) : ?>
    <?php
       if (is_home()) {
          query_posts("showposts=1");
       }
    ?>
    <?php while (have_posts()) : the_post(); ?>

    the result is the same.

    What am I doing wrong? I haven’t set up a home.php file, as that also did not work. This is going straight into my Main Index Template.

    Thanks for your assistance.

    Okay, I’ve changed my query to

    <?php
    if (is_home()) {
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("&posts_per_page=1&paged=$paged");
    }
    ?>
    <?php if (have_posts()) : ?>

    But it’s only showing one page on every page now, though the post IS changing. I only want it to show one post on the home page (I assmed that’s what the “is_home” would take care of – but it’s not???).

    Thanks again for any clarification.

    No suggestions?

    You have to use
    `query_posts($query_string . “&showposts=1”);

    I’m interested in putting the first 10 posts on the front page of my site. I googled and found this place where a similar question was asked.

    It seems there is assumed knowledge here because I don’t understand which file you guys are talking about. Could you please tell me the step-by-step procedure to changing the amount of posts that appears on the front page?

    PS. but not necessary:
    Is there a way to limit which categories are pooled from for the front page?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Limit front page only to one post’ is closed to new replies.