Last active
August 16, 2016 07:08
-
-
Save mzo84/3a5dfe7ce0ece085a3ef43861deb76dd to your computer and use it in GitHub Desktop.
Customizing the Loop with get_posts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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