WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Hide the latest post from the loop (6 posts)

  1. aliceralph
    Member
    Posted 3 years ago #

    I am trying to show my latest post at the top of the loop in full, with customisation etc... and then all the later posts (from 2nd to last onwards) as little thumbnail summaries in columns beneath. So basically have two loops on the same page that are styled separately - and one of the loops only shows one post.

    So far I have managed to hack it so it working perfectly EXCEPT the latest post shows up twice - once at the top of the page and once again in the summaries columns below.

    All I want is to hide the latest post from the main loop.

    (Btw I am using the loop-category.php as linking to one category from the Menu.)

    Anybody know?? Pretty please! :)

  2. esmi
    Forum Moderator
    Posted 3 years ago #

  3. aliceralph
    Member
    Posted 3 years ago #

    Hi esmi, thanks for replying. This is exactly what I'm after but not exactly sure where to put it??

    My code is below - note that it is calling one post first - this is the post that is then repeated below after have_posts.

    Any help gratefully received! Thanks in advance!

    [Code moderated as per the Forum Rules. Please use the pastebin]

  4. aliceralph
    Member
    Posted 3 years ago #

    Okay... can I try this? http://pastebin.com/y66CfJsf

  5. aliceralph
    Member
    Posted 3 years ago #

    Anyone? Still struggling with this. Can use this:

    http://www.wpbeginner.com/wp-themes/how-to-exclude-latest-post-from-the-wordpress-post-loop/

    ...and I can get it so that it hides the latest post, but then it shows every other post in the loop twice (presumably this is something to do with the fact that it is in two columns)...

    Any help gratefully received!

  6. aliceralph
    Member
    Posted 3 years ago #

    Hi I finally got this resolved. For anybody reading this, I replaced:

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

    with:

    <?php query_posts($query_string . 'offset=1' );?>
    <?php while ( have_posts() ) : the_post(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic