Skip Navigation

[Resolved] How to add additional filter to archive with parametric search

This support ticket is created 6 years, 11 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 2 replies, has 2 voices.

Last updated by Shane 6 years, 11 months ago.

Assisted by: Shane.

Author
Posts
#600863

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.

#600946

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

#601181

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