How to rearrange, orders, bookings and messages

How do I rearrange the order of orders, bookings, and messages to custom order, and is there any way to search let’s say by booking number, date, or name?
Thanks

Please let me know which sorting order you’d like to set, it’s possible but would probably require code customizations. For example, bookings appear by the booking start date, and also grouped by statuses (so pending bookings that require some action appear at the top, then unpaid bookings, then confirmed and finally canceled bookings appear at the bottom).

The best thing would be if you can add a “Sort By” option and a search option, but to set a default option then i need it in the order of “Booked on”

Thanks

Hi,
Thanks for your suggestion, we’ll consider adding this option.

1 Like

do you have a snippet to arrange according to Booked on Date?

If you mean to sort booking by date when it was created then please try this PHP snippet.

remove_filter( 'posts_orderby', [ hivepress()->booking, 'set_booking_order' ], 10, 2 );

add_filter(
	'posts_orderby', 
	function ( $orderby, $query ) {
		error_log($orderby);
		if ( $query->get( 'post_type' ) === 'hp_booking' && $query->get( 'hp_sort' ) ) {
			$orderby = 'post_date ASC, ' . $orderby;
		}

		return $orderby;
	},
	1000,
	2
);

But if you want to sort bookings by start or end time of booking then unfortunately, there is no simple solution for it. It requires advanced customization

2 Likes

Thank you very much, I’m wondering if it’s possible to change it from ascending to descending

Thanks anyway

Please try replacing ASC with DESC in the code snippet.

Thanks works perfectly

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.