• Hi and please sorry for my english.
    In my blog I use a layout with 3 different loops in home page.
    The main one, displays the latest post (so without a query_post tag), while each side loop returns the latest post from a specified category, using a query_post tag.
    Now, the problem is: if the latest “general” post belongs to a side loop category, that post will be shown twice, both in main and side loop.
    Is there a way to exclude from the side loops the latest post currently displayed in the main one?
    I hope I’ve been clear.
    I really appreciate an hint.
    Thanks to all.
    h.

Viewing 3 replies - 1 through 3 (of 3 total)
  • <?php query_posts('category_name=YOUR CAT NAME&showposts=1&offset=001'); ?>
    
      <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    offset=001 can be set to any number that you like 002,003, etc.. This will show the second newest,third, etc. post in a particular category.

    Hopefully this is what you are looking for?

    Thread Starter eggiog

    (@eggiog)

    Not really,
    In that way, if the newest post in the category is not shown in the main loop, will be not displayed in the side loop too, right? :\
    I think I have to give up >_<

    This; offset=001 only only skips one. If it reads offset=002 it will skip the first two posts. and so on.. Something that may be required, you may have to reset the loop before you begin the loop in the side bar. It will look like this:

    <?php rewind_posts(); ?> 
    
      <?php query_posts('category_name=YOUR CAT NAME&showposts=1&offset=001'); ?>
    
      <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    The rewind snip basically starts the loop or call to the db , the next snip of code tells wordpress where to look for the post, how many to show, and where to start in the cat.
    then the loop tells wordpress if you got a post under that criteria since you have found it, post it.

    I hope this help I will try to find out more for you

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multiple loops’ is closed to new replies.