You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.
This would be great. Naturally need an order param too, if adding orderby.
BTW, I use Simple Page Ordering for drag and drop ordering, and have used this to default the order to menu_order. Seems like it should sort by menu order by default IMO.
// Add menu_order support to FAQ's.
add_post_type_support( 'page-attributes', 'gs_faq' );
// Set FAQ's to sort by menu_order.
add_action( 'pre_get_posts', 'prefix_faq_cpt_order' );
function prefix_faq_cpt_order( $query ) {
// Bail if in admin.
if ( is_admin() ) {
return;
}
// Bail if not querying FAQ's.
if ( 'gs_faq' !== $query->get( 'post_type' ) ) {
return;
}
// Order by menu order.
$query->set( 'orderby', 'menu_order' );
$query->set( 'order','ASC' );
}
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The ability to set the orderby value of the widget and shortcode would be useful, especially when applying a limit/posts_per_page.
The text was updated successfully, but these errors were encountered: