Skip to content

Instantly share code, notes, and snippets.

@joshuadavidnelson
Created December 5, 2014 16:54
Show Gist options
  • Save joshuadavidnelson/2117974e48ec393c6279 to your computer and use it in GitHub Desktop.
Save joshuadavidnelson/2117974e48ec393c6279 to your computer and use it in GitHub Desktop.
custom query
<?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