January 27, 2017 at 9:40 am
Hello,
We currently have a slider (RevolutionSlider) that takes EE Events that have been tagged with Featured and displays them on the front page.
The issue is that the Date post metadata that we’re currently using to order the posts simply takes the date that the event was CREATED.
What we need is to access the event’s DateTime and use that as the sorting field. I have the PHP snippet that should do it:
function modify_slider_order($query, $slider_id) {
if($slider_id == 4) {
// Custom Meta key/name
$query['meta_key'] = 'meta-custom-date';
// Order by Custom Meta values
$query['orderby'] = 'meta-custom-date';
// Calculate order based on:
// 'NUMERIC', 'CHAR', 'DATE', 'DATETIME', 'TIME'
$query['meta_type'] = 'DATE';
}
return $query;
}
add_filter('revslider_get_posts', 'modify_slider_order', 10, 2);
So, what I need is to access the DateTime for the event. Any suggestions?
|