I'd like to sort the tour pages by the latest items.

Closed
Panagea - Hotel and Tours Booking WordPress Theme Panagea - Hotel and Tours Booking WordPress Theme February 15, 2019
Login to reply
os kim
5 years ago
Resolved.
Kelly R Support Agent
5 years ago

Hi,

Please edit /inc/frontend/tour/functions.php file.

In panagea_tour_get_search_result( $args ) function, you can find following code.

$main_sql = "SELECT DISTINCT t1.tour_id AS tour_id" . $sql;

$ids = $wpdb->get_results( $main_sql, ARRAY_A );

And replace with following codes.

$main_sql = "SELECT DISTINCT t1.tour_id AS tour_id" . $sql;

$main_sql = "SELECT m_t.tour_id, post_st.post_date FROM ( {$main_sql} ) AS m_t LEFT JOIN {$tbl_posts} post_st ON m_t.tour_id = post_st.ID ORDER BY post_st.post_date DESC ";
$ids = $wpdb->get_results( $main_sql, ARRAY_A );

And for restaurant, please edit panagea_restaurant_get_search_result function in /inc/frontend/restaurant/functions.php file

Find following code.

$main_sql = "SELECT DISTINCT t1.restaurant_id AS restaurant_id" . $sql;
$ids = $wpdb->get_results( $main_sql, ARRAY_A ); 

Replace with following.

$main_sql = "SELECT DISTINCT t1.restaurant_id AS restaurant_id" . $sql;

$main_sql = "SELECT m_t.restaurant_id, post_st.post_date FROM ( {$main_sql} ) AS m_t LEFT JOIN {$tbl_posts} post_st ON m_t.restaurant_id = post_st.ID ORDER BY post_st.post_date DESC ";
$ids = $wpdb->get_results( $main_sql, ARRAY_A ); 

Regards, C-Themes


os kim
5 years ago

The restaurant is just the same.

os kim
5 years ago

I'd like to sort the tour pages by the latest items.

I hope that the items that are added to the tour page are at the top.