Hi,
I have a CPT archive with parametric search that has a datepicker for a custom field created with Types, so far working fine. Now I need a filter that only events with current dates are displayed.
I tried to add this to functions.php (based on this thread: https://toolset.com/forums/topic/setting-view-to-current-month-on-initial-page-load/ ):
add_filter( 'wpv_filter_query', 'ktermine_datum', 100, 3 );
function ktermine_datum ( $query, $view_settings, $view_id ) {
if( $view_id == 8811 ) {
$uts = time();
$query_args['meta_query'][] = array(array(
'key' => 'wpcf-konzert-datum',
'value' => $uts,
'compare' => '>=',
'type' => 'NUMERIC,'
));
}
return $query_args;
}
Unfortunately no result, please, what am I doing wrong?
Thank you very much.
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Patty,
Thank you for contacting our support forum.
You hook seems to be fine, however I will need to debug further in order to see what wrong.
Would you mind providing me with admin access so that I can have a look ?
Thanks
Shane
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Patty,
This Date field wont be apart of the parametric search correct?
Please let me know.
Thanks,
Shane