[PiotnetGrid] Custom Post Archive page order
D
Debi Hazelden
Hi
I'm using Piotnet Grid for a Custom Post type and have a grid I've set to "current query". I'm wondering how I can set the order on this to "Menu Order". I'm using the plugin "simple custom post type order" which allows us to reorder our custom posts and if there is a selection to order by menu order this will work. But when I choose "current query" for the piotnet grid there isn't any order choice. Can you please help here? I want to use this as an archive page but I also need to order the posts.
Vic Pham
Solution:
Adjust some custom code in functions.php to order the Piotnet Grid on archive pages by the Simple Custom Post Type order:
// Sort All Courses by Menu Order
add_filter( 'parse_query', 'sorting_archives' );
function sorting_archives( $wp_query ) {
if (is_post_type_archive( 'course' ) || is_tax()) {
$wp_query->set( 'orderby', 'menu_order' );
$wp_query->set( 'order', 'ASC' );
}
return $wp_query;
}