Last active
November 4, 2015 14:36
-
-
Save nickberens360/a7c5eb2e7b907b5cfc97 to your computer and use it in GitHub Desktop.
wp pre_get_posts for cpt archive page
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
function wpc_order_post_type_archive( $query ) { | |
if($query->is_main_query() && is_post_type_archive('success-stories' )){ | |
$query->set('posts_per_page', -1); | |
$query->set('orderby', 'menu_order title'); | |
$query->set('order', 'ASC'); | |
} | |
} | |
add_action( 'pre_get_posts', 'wpc_order_post_type_archive' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment