-
Hi,
I’m using Query Loop to show pages. But I cant set order view (it’s showing most recently first). Any way to order using the default pages order on wordpress?
Thank you
-
Hi there,
Any way to order using the default pages order on wordpress?
Are you referring to the order option in the page quick editor?
https://wordpress.org/documentation/article/create-pages/#using-the-quick-edit-option
Let me know! -
Hi, Ying
Yes!
-
I see.
In this case, try the solution below:
1. Add an additional CSS class to the Grid block of the query loop block, eg.
order-by-menu-order
.2. Add the below PHP code:
add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) { if ( ! is_admin() && ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'order-by-menu-order' ) !== false ) { $query_args['orderby'] = 'menu_order'; } return $query_args; }, 10, 2 );
You can use one of the methods mentioned in this article to add PHP code:
Let me know how it goes 🙂
-
Hi, Ying
It actually works. But I would like to reverse the order.
For example I have set: 1, 2, 3, 4
But it’s showing: 4, 3, 2, 1I think I’m doing everything right
-
Hi there,
in the Query Loop you can Add Parameter:
1. Order By -> Menu Order
2. Order -> DESC or ASC depending which way you want them
-
Works!
Thank you, David. -
You’re welcome
- You must be logged in to reply to this topic.