Skip to content

Instantly share code, notes, and snippets.

@mzo84
Last active August 16, 2016 07:08
Show Gist options
  • Save mzo84/3a5dfe7ce0ece085a3ef43861deb76dd to your computer and use it in GitHub Desktop.
Save mzo84/3a5dfe7ce0ece085a3ef43861deb76dd to your computer and use it in GitHub Desktop.
Customizing the Loop with get_posts
<?php // additional loop via get_posts
global $post;
$args = array('category' => -9); // exclude Asides category
$custom_posts = get_posts($args);
foreach($custom_posts as $post) : setup_postdata($post);
...
endforeach;
?>
// get_posts takes its parameters as an array...
<?php
$args = array('category'=>-7,-8,-9, 'numberposts'=>3, 'order'=>'ASC');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment