I've found a few other tickets requesting this from a while back, and I see there still isn't the option to select THIS_WEEK in the Query Filter:
hidden link
Is there any workaround yet available for this? It would really be helpful to be able to filter my items by a custom date field that is set to dates of the current week.
Hi. I'm basically building a way to track working hours for a freelancer, so as he enters his hours/fee day by day he can see how many hours he has worked, and money earned, this current week so far.
So last 7 days won't work for this type of requirement. You can see the progress I've made so far here:
So how you want to setup "this _week" I'm not sure. If you can tell me your requirement how you want to filter using the custom date field I can guide you in the right direction.
What if you change your "Work Date" frontend filter you added to view's "Search and Pagination" section to use between so it will offer you the start work date and end work date as options and user will select the start work date and end work date and based on the selected dates user will be able to filter the results.
Sorry, I think I didn't explain well. So in the grey boxes you can see calculations for money earned and hours worked. So I have 2 views for that. They add up the hours and money of each new form entry. Now they are looping through all entries to calculate the money earned and hours. I want them to just add this current week's hours and money.
But it's not working and I think I'm just not getting the shortcode right, here's what I have now in my functions file:
add_shortcode( 'ts-thursday', 'ts_thursday_func');
function ts_thursday_func( $atts, $content ) {
$atts = shortcode_atts( array(
'index' => 0
), $atts );
$week_index = $atts['index'];
$timestamp = strtotime("this Monday");
// your custom code here should calculate the correct value for $timestamp
// $week_index will default to 0 unless the User provides one in the shortcode: $week_index
return $timestamp;
}
I just took a guess at the timestamp part, I really don't know php much at all. Maybe this is where the issue is?
Yes - that way you can filter the records. If you can share admin access details I will adjust the code and show it to you.
*** 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 have set the next reply to private which means only you and I have access to it.