Hi @cris18,
Yes, we do have some documentation on customizing the datepicker. That can be found here: https://yikesplugins.com/knowledge-base/customization-options-for-the-datepicker/
The line most relevant to you is going to be $options['change_year'] = true;. You’ll also want to make sure to update the form ID from 12 to the ID of the form you want to modify.
Let me know if that helps,
Jon
Thread Starter
cris18
(@cris18)
Thank you very much dor your complete answer, onlyt I have a question else? I should to write the next code:
add_filter( 'yikes-mailchimp-datepicker-options', 'yikes_mailchimp_customize_datepicker_options', 10, 2 );
function yikes_mailchimp_customize_datepicker_options( $options, $form_id ) {
if ( $form_id === 3 ) {
$options['change_year'] = true;
$options['change_month'] = true;
}
I have an error when I use it
Hi @cris18,
It looks like you are missing the curly brace to close the function. Add one more } at the end and you should be fine.
Let me know if that helps,
Jon
Thread Starter
cris18
(@cris18)
Thank you for your fast answer, now it is ok the code, but I have no dropdown years or month with calendar birthday with it 🙁
`add_filter( ‘yikes-mailchimp-datepicker-options’, ‘yikes_mailchimp_customize_datepicker_options’, 10, 2 );
function yikes_mailchimp_customize_datepicker_options( $options, $form_id ) {
if ( $form_id === 3 ) {
$options[‘change_year’] = true;
$options[‘change_month’] = true;
}}
I have 2 forms (id=1 and id=3), one for phone and another for pc, I put both id in separated codes, is there any mistake that i did not see it?
Hi @cris18,
Ah, so in that case, you’re probably running into a “function already defined” error. You can do one of two things:
1. Make the change_year and change_month true for all forms. That would look like this:
add_filter( 'yikes-mailchimp-datepicker-options','yikes_mailchimp_customize_datepicker_options', 10, 2 );
function yikes_mailchimp_customize_datepicker_options( $options, $form_id ) {
$options[‘change_year’] = true;
$options[‘change_month’] = true;
}
2. Check for either form, like this:
add_filter( 'yikes-mailchimp-datepicker-options','yikes_mailchimp_customize_datepicker_options', 10, 2 );
function yikes_mailchimp_customize_datepicker_options( $options, $form_id ) {
if ($form_id === 1 || $form_id === 3) {
$options[‘change_year’] = true;
$options[‘change_month’] = true;
}
}
Let me know if that works,
Jon
-
This reply was modified 5 years, 1 month ago by
jpowersdev.