Last active
March 27, 2018 11:25
-
-
Save sarathlal-old/bc26aee6b5a5594ebd672aeafc6916b4 to your computer and use it in GitHub Desktop.
filter default query
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
add_action( 'pre_get_posts', 'custom_post_type_archive' ); | |
function custom_post_type_archive( $query ) { | |
if( $query->is_main_query() && !is_admin() && is_post_type_archive( 'gallery' ) ) { | |
$query->set( 'posts_per_page', '12' ); | |
$query->set( 'orderby', 'menu_order' ); | |
$query->set( 'order', 'ASC' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment