Created
May 20, 2012 13:15
-
-
Save billerickson/2758095 to your computer and use it in GitHub Desktop.
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
<?php | |
/** | |
* Sort post archives by menu order | |
* | |
* To be used in conjunction with CMS Page Order and https://gist.github.com/2758065 | |
* | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/customize-the-wordpress-query/ | |
* @param object $query data | |
* | |
*/ | |
function be_post_archive_query( $query ) { | |
if( $query->is_main_query() && ( $query->is_home() || $query->is_archive() ) ) { | |
$query->set( 'orderby', 'menu_order' ); | |
$query->set( 'order', 'ASC' ); | |
} | |
} | |
add_action( 'pre_get_posts', 'be_post_archive_query' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment