Hi Minesh,
Sorry for late response. Thank you very much for your help in accomplishing this.
As far as the other issue.
The Past Bid Table should only show bid dates that are yesterday and past. Similar to this filter we did it will show the past date and everything before that date. Here is the code to make this happen.
/**
* New custom code snippet (replace this with snippet description).
*/
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
// Put the code of your snippet below this comment.
function filter_bid_date_default_pasttable($view_args, $view_settings, $view_id) {
$timestamp = current_time('timestamp');
$yesterday = strtotime('-12 hours', $timestamp);
if (in_array($view_id, array(41104))) {
// slug of the bid date field
$bid_field_slug = "wpcf-bid_date";
// check for the existing meta query filters
if(!empty($view_args['meta_query'])) {
foreach ($view_args['meta_query'] as $meta_query_arr ) {
if( (!empty($meta_query_arr['key'])) && (isset($meta_query_arr['key'])) ) {
$available_keys[] = $meta_query_arr['key'];
}
}
}
else {
$available_keys[] = '';
}
// if no user filter for the bid date exists add a fixed one
if (!in_array($bid_field_slug, $available_keys)) {
$view_args['meta_query'][] = array(
'key' => $bid_field_slug,
'value' => $yesterday,
'type' => 'CHAR',
'compare' => '<='
);
}
}
Hi Minesh,
Thank you for creating a new ticket for me.
Yes, no problem. I will share with you the link and screenshots on what it does currently and what it should do.
Link: hidden link
This link is supposed to show all the posts that have a bid date that is less than < "today's date". However, with the new code we put in, it is now showing posts that are equal to and less than <= "today's date". This is with no filter added, only how the page will load the first time we go to it.
In the screenshot below you will see that today's date is 03-24. The link should only be showing bid dates 03-23, but it is now showing 03-24. The desired results are for the table to show 1 day less than today's date ie: x<today's date (not <=)
Ok - as I understand, when the page is loaded, by default, it should display all the posts whose date is 1 day less. So, this is about when page loaded and view loaded.
When the user selects the filter - the code I shared in previous ticket, that is OK - no need to change that, correct?
Can you please check now. I've disable the filter code which you added with the custom code snippet "pasttable-prefilter" as that code was not required anymore.
I've adjusted the filter I've added with the custom code snippet "toolset-custom-code" as given under: