Skip Navigation

[Resolved] Display Order by custom date field Hook

This support ticket is created 5 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 1 voice.

Last updated by marianD-3 5 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1250135

Hi

I have a list of events and I'd like to filter these events by date. The date field comes from a custom field ([rhc_next_upcoming_dates]) ( hidden link ) which is not built with Toolset.

I have tried this but it doesn't work

add_filter('wpv_filter_query', 'add_custom_fields_to_view_query', 99, 3);
function add_custom_fields_to_view_query($query_args, $view_settings, $view_id ) {
if ( $view_id == 61 ){
return;
}

$meta_query = array();
$meta_query[] = array('key' => 'rhc_next_upcoming_dates');

return $query_args;
}
function custom_order($orderby) {
global $wpdb;
return $wpdb->postmeta.'.meta_value, mt1.meta_value, post_date ASC';
}

Regards

#1250141

My issue is resolved now. Thank you!