Fix bugs, use plural post slugs, move actions and filters into hooks folder
This commit is contained in:
15
admin/hooks/pre-get-posts.php
Normal file
15
admin/hooks/pre-get-posts.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
function sportspress_pre_get_posts( $wp_query ) {
|
||||
if ( is_admin() ):
|
||||
$post_type = $wp_query->query['post_type'];
|
||||
|
||||
if ( in_array( $post_type, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_statistic' ) ) ):
|
||||
$wp_query->set( 'orderby', 'menu_order' );
|
||||
$wp_query->set( 'order', 'ASC' );
|
||||
elseif ( $post_type == 'sp_event' ):
|
||||
$wp_query->set( 'orderby', 'post_date' );
|
||||
$wp_query->set( 'order', 'ASC' );
|
||||
endif;
|
||||
endif;
|
||||
}
|
||||
add_filter('pre_get_posts', 'sportspress_pre_get_posts');
|
||||
Reference in New Issue
Block a user