Support

Account

Home Forums General Issues Datepicker to text field Reply To: Datepicker to text field

  • I’ve usually done this with a date picker field that isn’t required then an alternative free text field. On the front end, I’ve then had it checking for whatever should be the priority first then falling back to the other field type. Then in the backend on the prioritized field, I usually note in the instructions that if the field is populated, it will take priority over the other.

    So maybe you have a text field that is called something like Starting Date and then a date picker field called Exact Start Date and you note that if the exact start date is populated, it will take priority over the starting date text field (in case someone populates both and you only want one)

    Something like:

    $exactDate = get_field('exact_start_date');
    if ( $exactDate ) {
      echo $exactDate;
    } else {
      // the text field
      the_field('starting_date');
    }