Skip to content

Instantly share code, notes, and snippets.

@whatjackhasmade
Created July 21, 2017 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatjackhasmade/10d56d4240d3b64d0cf5c72ae894eb1b to your computer and use it in GitHub Desktop.
Save whatjackhasmade/10d56d4240d3b64d0cf5c72ae894eb1b to your computer and use it in GitHub Desktop.
Use More Than One Loop On A Page, Without Printing Duplicate Posts
<?php
query_posts('showposts=8');
$ids = array();
while (have_posts()) : the_post();
$ids[] = get_the_ID();
the_title();
the_content();
endwhile;
?>
<?php
query_posts(array('post__not_in' => $ids));
while (have_posts()) : the_post();
the_title();
the_content();
endwhile;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment