Slider Revolution WP
09.27.2016
The “Custom Order” option will sort the posts by their menu order. Menu order for posts can be modified in a variety of ways, several of which are listed in this tutorial.
Modify the slider’s default WP_Query to sort posts by their Custom Meta values. Modify the parameters for your custom post meta, and then add the code to your theme’s “functions.php” file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
function modify_slider_order($query, $slider_id) { // only alter the order for slider with "x" ID // https://tinyurl.com/zb6hzpc 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); |