Support » Fixing WordPress » News Repeats itself on the front page

  • senorwakko

    (@senorwakko)


    Hello,

    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.

Viewing 1 replies (of 1 total)
  • 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,
Viewing 1 replies (of 1 total)
  • The topic ‘News Repeats itself on the front page’ is closed to new replies.