Last active
December 23, 2015 00:19
-
-
Save imknight/6552491 to your computer and use it in GitHub Desktop.
Sort the posts order in page
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
add_filter('pre_get_posts', 'pre_get_posts_hook' ); | |
function pre_get_posts_hook($wp_query) { | |
if (is_page()) | |
{ | |
$wp_query->set( 'orderby', 'title' ); | |
$wp_query->set( 'order', 'ASC' ); | |
return $wp_query; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment