Creating Date Filter w/ Pods
-
I am trying to add a filter to this pod’s feed so that old events won’t show. Here’s my code in functions.php:
function date_filter_function($query_args){
$today = date(‘Ymd’);
$query_args[‘meta_key’] = ‘date_of_event’;
$query_args[‘meta_compare’] = ‘>=’;
$query_args[‘meta_value_num’] = $today;return $query_args;
}add_filter(‘date_filter’, ‘date_filter_function’);
I’m fairly certain the reason this isn’t working is because the ‘date_of_event’ custom field in the pod does not return the date in the same format (‘Ymd’) as the $today variable I created. Does anyone know how to change the format of the date within the filter for each post? That way, the greater than or equal to comparison will actually make sense.
The page I need help with: [log in to see the link]
- The topic ‘Creating Date Filter w/ Pods’ is closed to new replies.