groups

name language licence
Auto-Resize Images Using TimThumb And WordPress Shortcodes PHP Other
Dropping in Your Own Logo PHP Other
Use More Than One Loop On A Page, Without Printing Duplicate Posts PHP Other
Get Posts With A Specific Custom Field And Specific Value PHP Other
Create A Loop Of Images PHP Other
Using Multiple Loops PHP Other

< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 >



language: PHP
licence: Other

Use More Than One Loop On A Page, Without Printing Duplicate Posts

options: view full snippetsend to code collector
Let’s start with the first loop. Nothing hard here: we’re just going to get the eight most recent posts using the showposts parameter. Open the index.php file, and paste the following code to output your “featured” posts:

<?php
query_posts('showposts=8');
$ids = array();
while (have_posts()) : the_post();
$ids[] = get_the_ID();
the_title();
the_content();
endwhile;
?>

Once that’s done, it’s time to apply our second loop and get all posts, excepted the ones we have already outputted in the first loop:

<?php
	
(Continues...)