This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Date picker

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #53995
    fabrisysfabrisys
    Participant

    In the date selector, I can select up to a maximum of 10 years ago (2015), I need to be able to select up to 100 years ago and beyond. Do you have any advice on how to do this? Thanks

    #53997
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    Yes, it should be possible to do with a small custom code snippet:

    add_action('wp_footer', 'wp_footer_datepicker_range_fix', 9999);
    function wp_footer_datepicker_range_fix() {
    	?>
    	<script>
    	(function($){
    		setTimeout(function(){
    			$('.asp_w .hasDatepicker').datepicker('option', 'yearRange', '-100:+100')
    		}, 500);
    	})(jQuery);
    	</script>
    	<?php
    }

    Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.

    #53998
    fabrisysfabrisys
    Participant

    It works perfectly, thanks!

    #53999
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You are very welcome 🙂

    If you don’t mind, I will close this topic soon and mark it as resolved, feel free to open another one if you have other questions or issues.

    If you like the plugin and have not rated already, feel free to leave a rating on the wordpress plugin repository, it’s greatly appreciated.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.