Problem:
The issue here is that the user wanted to query their posts that were modified in the last 4 weeks using views.
Solution:
In order to do this you will need to use the view wpv_filter_query hook.
Have a look at the hook example below.
function tssupp_filter_query($view_args, $view_settings, $view_id) { $view_ids = array( 123, 456 ); // Edit for View IDs to apply to if ( in_array($view_id, $view_ids) ) { $view_args['date_query'] = array( 'after' => '4 weeks ago', 'column' => 'post_modified' ); } return $view_args; } add_filter('wpv_filter_query', 'tssupp_filter_query', 101, 3);
Add this to your Toolset custom code section in Toolset->Settings -> Custom Code and ensure that you've clicked on activate after saving.
You will need to change the 123,456 to the ID of your view that you want this hook to apply to.
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 3 years, 10 months ago.
Assisted by: Shane.