Hi there Team HP
I refer topic Orders and Bookings display order in which Ihor replied:
…newest orders should appear at the top by default. Also, there’s a known bug with Bookings where past bookings are not moved to the bottom, we’re working on fixing this. By default the nearest bookings should be displayed at the top, regardless of the booking confirmation date.
While scrolling through the code (hivepress-bookings\includes\components\class-booking.php) looking for something else, I stumbled across this piece of code
/**
* Sets booking order.
*
* @param string $orderby ORDER BY clause.
* @param WP_Query $query Query object.
* @return string
*/
public function set_booking_order( $orderby, $query ) {
if ( $query->get( 'post_type' ) === 'hp_booking' && $query->get( 'hp_sort' ) ) {
$orderby = 'post_status ASC, ' . $orderby;
}
return $orderby;
}
Which confirms my previous issue of the oldest bookings always being displayed at the top with the newest at the bottom causing users to need to scroll to the bottom of the page to see the newest bookings. 'post_status ASC, ’
It should be descending if the newest bookings (orders in our use case) are to be at the top, not?
Complements of Google:
Answer: In general terms, Ascending means smallest to largest, 0 to 9, and/or A to Z and Descending means largest to smallest, 9 to 0, and/or Z to A. Ascending order means the smallest or first or earliest in the order will appear at the top of the list: For numbers or amounts, the sort is smallest to largest.
So to have the booking (order) with the greatest number at the top, it does need to be sorted by Descending (DESC), or am I getting this all wrong?