News Repeats itself on the front page (2 posts)

  1. senorwakko
    Posted 3 years ago #


    I have two places on the front page of the site that has news showing... the top spot shows the last five, then when you scroll down, it shows more news after a couple of other categories are added. The issue is that the other news section shows the top five, then the rest. That seems to be redudant, I am looking to find code that would not show the top five and go down the list from there. Any help would be appreciated.

  2. vtxyzzy
    Posted 3 years ago #

    Do you have two separate queries? If so, record the IDs of the posts in the first loop and use them in a 'post__not_in' argument in the second loop.

    Put this before the first loop:

    $do_not_duplicate = array();

    Put this inside the first loop:

    $do_not_duplicate[] = $post->ID;

    In the arguments for the second loop, use this:

    'post__not_in' => $do_not_duplicate,

Topic Closed

This topic has been closed to new replies.

About this Topic