Last active
December 17, 2015 08:08
-
-
Save JiveDig/5577769 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Sort credits post type archive by credit year | |
add_action('pre_get_posts','child_alter_credits_archive_query'); | |
function child_alter_credits_archive_query( $query ) { | |
if( $query->is_main_query() && is_post_type_archive('credits') ) { | |
$query->set( 'meta_key', 'credit_year' ); | |
$query->set( 'orderby', 'meta_value_num' ); | |
$query->set( 'order', 'DESC' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment