Loop Help (6 posts)

  1. masellaus
    Posted 3 years ago #

    What I am wanting to do and I'm not sure how is to include in my loop 10 excerpts on the page but I want to skip the most current 5. I know that I have to put a wp_query somewhere with a number of posts and an offset but I don't know how to modify the current loop seen below to do that. Any help is appreciated.

    <?php $theme->hook('content_before'); ?>
             if (have_posts()) : while (have_posts()) : the_post();
                   get_template_part('post', 'homepage');
             else :
                get_template_part('post', 'noresults');
  2. Marvel Labs
    Posted 3 years ago #

    Dear masellaus.

    care to explain with an example. please mention the site name as well.

  3. masellaus
    Posted 3 years ago #


    It is my personal blog... I have a scroller at the top that has the most recent 5 articles displayed in rotation. I don't want to include those in the main body of that page so I would like it to start at the 6th most recent post in the body so as to not duplicate content on that main page.

  4. masellaus
    Posted 3 years ago #

    Since it doesn't have the wpquery in there at all I am guessing I would have to add a line to do the query and then use the result somewhere in the while?

  5. esmi
    Forum Moderator
    Posted 3 years ago #

    I'm sorry but your chosen theme is not released under GPL. Non GPL products are not welcome in the WordPress community. Official WordPress policy states that all plugins and themes that are publicly released are required to adhere to http://wordpress.org/about/gpl/

    I would strongly recommend that you read this article and then download another theme.

  6. Michael
    Forum Moderator
    Posted 3 years ago #

    general and untested:

    either modify the loop with a query and the 'offset' parameter;

    i.e. add something like this before the 'if(have_posts())':

    global $query_string; query_posts( $query_string .'&offset=5' );

    this will break any pagination you might have had...

    or preferrable, try to get the post ids from the posts in the slider, then use this with the 'post__not_in' parameter in a query before the loop;

    for the approach, see http://codex.wordpress.org/The_Loop#Multiple_Loops_in_Action


Topic Closed

This topic has been closed to new replies.

About this Topic