-
AuthorPosts
-
June 29, 2017 at 6:31 am #814251
Hi,
As the title says. I need the datepicker to only make the last friday of the month able to select. How do I do this?
Thanks!
June 29, 2017 at 3:15 pm #814523Hey Abosict,
You might get an idea here
https://stackoverflow.com/questions/3805486/jquery-datepicker-only-select-mondays-and-thursdays
https://stackoverflow.com/questions/12061483/jquery-ui-datepicker-disable-all-days-except-first-and-15th-day-of-each-monthIf you need further assistance please let us know.
Best regards,
VictoriaJuly 1, 2017 at 6:54 am #815258Thanks for you answer, I tried coding it, but I can’t get it to work. Also I don’t know where to put my code. Could you help me with the code, please?
July 1, 2017 at 7:45 am #815282if you are working with a child theme do this in your functions.php:
function determine_last_friday() { ?> <script type="text/javascript"> function enableLastFriday(date) { var lastDayInMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(); var isFriday = date.getDay() == 5; var isLastDayOfMonth = date.getDate() > lastDayInMonth - 7; return [isFriday && isLastDayOfMonth, '']; } </script> <?php } add_action('wp_footer', 'determine_last_friday', 10); function only_last_friday() { ?> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery.datepicker.setDefaults({ beforeShowDay: enableLastFriday }); }); </script> <?php } add_action('wp_footer', 'only_last_friday', 20);PPS: i had to splitt that functions- because i don’t want to override the enfold settings to datepicker template
see here in contact form element: https://webers-testseite.de/8-columns/
-
This reply was modified 8 years, 4 months ago by
Guenni007.
July 1, 2017 at 7:49 am #815285and by the way you can highlight that field by quick css:
#top .avia-datepicker-div td:not(.ui-datepicker-unselectable) a { background-color: #0f0; color: #000; }July 1, 2017 at 12:01 pm #815337Hi,
Thanks for sharing and helping out @guenni007, did you try that out @abosict?
Best regards,
RikardJuly 1, 2017 at 6:25 pm #815387You’re a hero! Thanks mr. Guenni!
July 1, 2017 at 7:02 pm #815397Hi,
Glad @guenni007 was able to help, we will close this now. Thank you for using Enfold.Best regards,
Mike -
This reply was modified 8 years, 4 months ago by
-
AuthorPosts
- The topic ‘Only show last friday of the month in datepicker’ is closed to new replies.
