Created
December 5, 2014 16:54
-
-
Save joshuadavidnelson/2117974e48ec393c6279 to your computer and use it in GitHub Desktop.
custom query
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 | |
/** | |
* Custom Query for custom archive page | |
* See: http://www.billerickson.net/code/wp_query-arguments/ | |
*/ | |
function jdn_custom_query() { | |
$args = array( | |
'posts_per_page' => 7, | |
'post_type' => 'post', | |
'orderby' => 'date', | |
'order' => 'DESC', | |
'cat' => 5, // change to the category id you want to display | |
'paged' => get_query_var( 'paged' ), | |
); | |
$year = get_query_var( 'yr' ); | |
if( isset( $year ) ) | |
$args['year'] = $year; | |
return $args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment