[Resolved] Problems With Filtering Views Query by Date
This support ticket is created 6 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Hello. Thank you for contacting the Toolset support.
Well - first of all, after checking debug information you shared with us I found that you are running with outdated Toolset plugins.
*** Please make a FULL BACKUP of your database and website.***
Could you please update ALL Toolset plugins to it's latest official release version. You can download latest Toolset plugins from:
=> https://toolset.com/account/downloads/
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.
1. How can I Skip first 5 items ?
=> Well - to skip the first 5 items, we have setting available on views page. Please check the following image: hidden link
2. How can I view posts posted in the time period 3-7 days ago?
=> That means you want to dispaly only 4 days old post in range 3-7. I've modified your view's filter as given under:
add_filter( 'wpv_filter_query', 'limit_query_one_day', 10, 3 );
function limit_query_one_day($query_args, $view_setting, $view_id){
if ($view_id == 5439){
$query_args['date_query'] = array(
array(
'before' => '3 day ago',
'after' => '7 day ago',
)
);
}
return $query_args;
}
You can adjust days values according to your requirement.