add "step by year" in data range-slider filter
Opened this issue · 3 comments
rbrazileiro commented
I'd like add "step by year" in date range slider filter for markers. I saw in dateRangeSlider a step option by year, month, minute, seconds... http://ghusse.github.io/jQRangeSlider/documentation.html#stepOption
How can I do?
abraços
miguelpeixe commented
There's also a WordPress filter to pass options used in the dateRangeSlider. Here's an example of how to do this in your child theme:
function my_range_slider_options($options) {
$options = array(
'rangeType' => 'dateRangeSlider', // This can be dateRangeSlider or rangeSlider
'options' => array( // This are the JQRangeSlider available options
'dateFormat' => 'MM/DD/YYYY', // This custom option uses momentjs library and JQRangeSlider formatter option to format date
'step' => array('years' => 1)
)
);
return $options;
}
add_filter('jeo_range_slider_options', 'my_range_slider_options');
If you want a different metadata to be used instead of post date to perform filtering, you can also do that:
function my_range_slider_filter_property() {
global $post;
return get_post_meta($post->ID, 'custom_post_data', true);
}
add_filter('jeo_range_slider_filter_property', 'my_range_slider_filter_property');
rbrazileiro commented
@miguelpeixe the slider only work in one year (2013) even after changes. both values are 2013.
miguelpeixe commented
@rbrazileiro any luck with this? are you setting different range slider options?
can you paste your code here?