name = 'date_picker'; $this->label = __("Date Picker",'acf'); $this->category = __("jQuery",'acf'); $this->defaults = array( 'date_format' => 'yymmdd', 'display_format' => 'dd/mm/yy', 'first_day' => 1, // monday ); // actions add_action('init', array($this, 'init')); // do not delete! parent::__construct(); } /* * init * * This function is run on the 'init' action to set the field's $l10n data. Before the init action, * access to the $wp_locale variable is not possible. * * @type action (init) * @date 3/09/13 * * @param N/A * @return N/A */ function init() { global $wp_locale; $this->l10n = array( 'closeText' => __( 'Done', 'acf' ), 'currentText' => __( 'Today', 'acf' ), 'monthNames' => array_values( $wp_locale->month ), 'monthNamesShort' => array_values( $wp_locale->month_abbrev ), 'monthStatus' => __( 'Show a different month', 'acf' ), 'dayNames' => array_values( $wp_locale->weekday ), 'dayNamesShort' => array_values( $wp_locale->weekday_abbrev ), 'dayNamesMin' => array_values( $wp_locale->weekday_initial ), 'isRTL' => isset($wp_locale->is_rtl) ? $wp_locale->is_rtl : false, ); } /* * create_field() * * Create the HTML interface for your field * * @param $field - an array holding all the field's data * * @type action * @since 3.6 * @date 23/01/13 */ function create_field( $field ) { // make sure it's not blank if( !$field['date_format'] ) { $field['date_format'] = 'yymmdd'; } if( !$field['display_format'] ) { $field['display_format'] = 'dd/mm/yy'; } // html echo '
'; echo ''; echo ''; echo '
'; } /* * create_options() * * Create extra options for your field. This is rendered when editing a field. * The value of $field['name'] can be used (like bellow) to save extra data to the $field * * @type action * @since 3.6 * @date 23/01/13 * * @param $field - an array holding all the field's data */ function create_options( $field ) { // global global $wp_locale; // vars $key = $field['name']; ?>

'text', 'name' => 'fields[' .$key.'][date_format]', 'value' => $field['date_format'], )); ?>

'text', 'name' => 'fields[' .$key.'][display_format]', 'value' => $field['display_format'], )); ?> weekday ); do_action('acf/create_field', array( 'type' => 'select', 'name' => 'fields['.$key.'][first_day]', 'value' => $field['first_day'], 'choices' => $choices, )); ?>