Skip Navigation

[Resolved] Filter only works on last view

This support ticket is created 4 years 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.

This topic contains 1 reply, has 1 voice.

Last updated by rachelP-2 4 years ago.

Author
Posts
#1887839

Tell us what you are trying to do?
There are 3 views on the page, 346, 110, and 206.
I want to display posts from last 7 days in view number 110, so I add this to functions.php:
``add_filter('wpv_filter_query', function($query, $settings, $view_id){
if( in_array($view_id, array(110)) ){
$query['date_query']['after'] = date_i18n( get_option( 'date_format' ), strtotime( '-8 days' ) );
}
return $query;
}, 10, 3);
``
It doesn't work, but if I change 110 to 206, it works for the last view on the page. How can I get it to work for the middle view, 110?

#1887891

My issue is resolved now. Thank you!