function input_admin_enqueue_scripts() { // bail ealry if no enqueue if (!acf_get_setting('enqueue_select2')) { return; } // globals global $wp_scripts, $wp_styles; // vars $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; $major = acf_get_setting('select2_version'); $version = ''; $script = ''; $style = ''; // v4 if ($major == 4) { $version = '4.0'; $script = acf_get_dir("assets/inc/select2/4/select2.full{$min}.js"); $style = acf_get_dir("assets/inc/select2/4/select2{$min}.css"); // v3 } else { $version = '3.5.2'; $script = acf_get_dir("assets/inc/select2/3/select2{$min}.js"); $style = acf_get_dir("assets/inc/select2/3/select2.css"); } // enqueue wp_enqueue_script('select2', $script, array('jquery'), $version); wp_enqueue_style('select2', $style, '', $version); }
function input_admin_enqueue_scripts() { // script wp_enqueue_script('jquery-ui-datepicker'); // style wp_enqueue_style('acf-datepicker', acf_get_dir('assets/inc/datepicker/jquery-ui.min.css'), '', '1.11.4'); }
function wp_init() { // register acf scripts wp_register_script('acf-pro-input', acf_get_dir('pro/js/pro-input.js'), false, acf_get_setting('version')); wp_register_style('acf-pro-input', acf_get_dir('pro/css/pro-input.css'), false, acf_get_setting('version')); // register acf scripts wp_register_script('acf-pro-field-group', acf_get_dir('pro/js/pro-field-group.js'), false, acf_get_setting('version')); wp_register_style('acf-pro-field-group', acf_get_dir('pro/css/pro-field-group.css'), false, acf_get_setting('version')); }
function input_admin_enqueue_scripts() { // vars $version = '1.6.1'; // script wp_enqueue_script('acf-timepicker', acf_get_dir('assets/inc/timepicker/jquery-ui-timepicker-addon.min.js'), array('jquery-ui-datepicker'), $version); // style wp_enqueue_style('acf-timepicker', acf_get_dir('assets/inc/timepicker/jquery-ui-timepicker-addon.min.css'), '', $version); }
function input_admin_enqueue_scripts() { // bail ealry if no enqueue if (!acf_get_setting('enqueue_datepicker')) { return; } // script wp_enqueue_script('jquery-ui-datepicker'); // style wp_enqueue_style('acf-datepicker', acf_get_dir('assets/inc/datepicker/jquery-ui.min.css'), '', '1.11.4'); }
function wp_init() { // min $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; // register scripts wp_register_script('acf-pro-input', acf_get_dir("pro/js/pro-input{$min}.js"), false, acf_get_setting('version')); wp_register_script('acf-pro-field-group', acf_get_dir("pro/js/pro-field-group{$min}.js"), false, acf_get_setting('version')); // register styles wp_register_style('acf-pro-input', acf_get_dir('pro/css/pro-input.css'), false, acf_get_setting('version')); wp_register_style('acf-pro-field-group', acf_get_dir('pro/css/pro-field-group.css'), false, acf_get_setting('version')); }
function mce_external_plugins($plugins) { // global global $wp_version; // WP 3.9 an above if (version_compare($wp_version, '3.9', '>=')) { // add code $plugins['code'] = acf_get_dir('inc/tinymce/plugins/code/plugin.min.js'); } // return return $plugins; }
function input_admin_enqueue_scripts() { // bail ealry if no enqueue if (!acf_get_setting('enqueue_datetimepicker')) { return; } // vars $version = '1.6.1'; // script wp_enqueue_script('acf-timepicker', acf_get_dir('assets/inc/timepicker/jquery-ui-timepicker-addon.min.js'), array('jquery-ui-datepicker'), $version); // style wp_enqueue_style('acf-timepicker', acf_get_dir('assets/inc/timepicker/jquery-ui-timepicker-addon.min.css'), '', $version); }
function input_admin_enqueue_scripts() { // globals global $wp_scripts, $wp_styles; // vars $version = '3.5.2'; $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; // script wp_enqueue_script('select2', acf_get_dir("assets/inc/select2/select2{$min}.js"), array('jquery'), $version); // style wp_enqueue_style('select2', acf_get_dir('assets/inc/select2/select2.css'), '', $version); // v4 //wp_enqueue_script('select2', acf_get_dir("assets/inc/select2/dist/js/select2.full.js"), array('jquery'), '4.0', true ); //wp_enqueue_style('select2', acf_get_dir("assets/inc/select2/dist/css/select2{$min}.css"), '', '4.0' ); }
function wp_init() { // complete loading of ACF files $this->complete(); // vars $cap = acf_get_setting('capability'); // Create post type 'acf-field-group' register_post_type('acf-field-group', array('labels' => array('name' => __('Field Groups', 'acf'), 'singular_name' => __('Field Group', 'acf'), 'add_new' => __('Add New', 'acf'), 'add_new_item' => __('Add New Field Group', 'acf'), 'edit_item' => __('Edit Field Group', 'acf'), 'new_item' => __('New Field Group', 'acf'), 'view_item' => __('View Field Group', 'acf'), 'search_items' => __('Search Field Groups', 'acf'), 'not_found' => __('No Field Groups found', 'acf'), 'not_found_in_trash' => __('No Field Groups found in Trash', 'acf')), 'public' => false, 'show_ui' => true, '_builtin' => false, 'capability_type' => 'post', 'capabilities' => array('edit_post' => $cap, 'delete_post' => $cap, 'edit_posts' => $cap, 'delete_posts' => $cap), 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'supports' => array('title'), 'show_in_menu' => false)); // Create post type 'acf-field' register_post_type('acf-field', array('labels' => array('name' => __('Fields', 'acf'), 'singular_name' => __('Field', 'acf'), 'add_new' => __('Add New', 'acf'), 'add_new_item' => __('Add New Field', 'acf'), 'edit_item' => __('Edit Field', 'acf'), 'new_item' => __('New Field', 'acf'), 'view_item' => __('View Field', 'acf'), 'search_items' => __('Search Fields', 'acf'), 'not_found' => __('No Fields found', 'acf'), 'not_found_in_trash' => __('No Fields found in Trash', 'acf')), 'public' => false, 'show_ui' => false, '_builtin' => false, 'capability_type' => 'post', 'capabilities' => array('edit_post' => $cap, 'delete_post' => $cap, 'edit_posts' => $cap, 'delete_posts' => $cap), 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'supports' => array('title'), 'show_in_menu' => false)); // min $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; // register scripts $scripts = array(array('handle' => 'select2', 'src' => acf_get_dir("assets/inc/select2/select2{$min}.js"), 'deps' => array('jquery')), array('handle' => 'acf-input', 'src' => acf_get_dir("assets/js/acf-input{$min}.js"), 'deps' => array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-resizable', 'jquery-ui-datepicker', 'wp-color-picker', 'select2')), array('handle' => 'acf-field-group', 'src' => acf_get_dir("assets/js/acf-field-group{$min}.js"), 'deps' => array('acf-input'))); foreach ($scripts as $script) { wp_register_script($script['handle'], $script['src'], $script['deps'], acf_get_setting('version')); } // register styles $styles = array(array('handle' => 'select2', 'src' => acf_get_dir('assets/inc/select2/select2.css'), 'deps' => false), array('handle' => 'acf-datepicker', 'src' => acf_get_dir('assets/inc/datepicker/jquery-ui-1.10.4.custom.min.css'), 'deps' => false), array('handle' => 'acf-global', 'src' => acf_get_dir('assets/css/acf-global.css'), 'deps' => false), array('handle' => 'acf-input', 'src' => acf_get_dir('assets/css/acf-input.css'), 'deps' => array('acf-global', 'wp-color-picker', 'select2', 'acf-datepicker')), array('handle' => 'acf-field-group', 'src' => acf_get_dir('assets/css/acf-field-group.css'), 'deps' => array('acf-input'))); foreach ($styles as $style) { wp_register_style($style['handle'], $style['src'], $style['deps'], acf_get_setting('version')); } }
function enqueue_assets() { // globals global $wp_scripts, $wp_styles; // vars $version = '3.5.2'; $lang = get_locale(); $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; //$lang = 'fr'; // v4 /* wp_enqueue_script('select2', acf_get_dir("assets/inc/select2/dist/js/select2.full.js"), array('jquery'), '4.0', true ); wp_enqueue_style('select2', acf_get_dir("assets/inc/select2/dist/css/select2{$min}.css"), '', '4.0' ); return; */ // register script if (!isset($wp_scripts->registered['select2'])) { // scripts wp_register_script('select2', acf_get_dir("assets/inc/select2/select2{$min}.js"), array('jquery'), $version); // translation if ($lang) { // vars $lang = str_replace('_', '-', $lang); $lang_code = substr($lang, 0, 2); $lang_src = ''; // attempt 1 if (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang_code}.js"))) { $lang_src = acf_get_dir("assets/inc/select2/select2_locale_{$lang_code}.js"); // attempt 2 } elseif (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang}.js"))) { $lang_src = acf_get_dir("assets/inc/select2/select2_locale_{$lang}.js"); } // enqueue if ($lang_src) { wp_enqueue_script('select2-l10n', $lang_src, array('select2'), $version); } } // end translation } // register style if (!isset($wp_styles->registered['select2'])) { wp_register_style('select2', acf_get_dir('assets/inc/select2/select2.css'), '', $version); } // enqueue wp_enqueue_script('select2'); wp_enqueue_style('select2'); }
function wp_init() { // vars $cap = acf_get_setting('capability'); $version = acf_get_setting('version'); $lang = get_locale(); $scripts = array(); $styles = array(); $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; // Create post type 'acf-field-group' register_post_type('acf-field-group', array('labels' => array('name' => __('Field Groups', 'acf'), 'singular_name' => __('Field Group', 'acf'), 'add_new' => __('Add New', 'acf'), 'add_new_item' => __('Add New Field Group', 'acf'), 'edit_item' => __('Edit Field Group', 'acf'), 'new_item' => __('New Field Group', 'acf'), 'view_item' => __('View Field Group', 'acf'), 'search_items' => __('Search Field Groups', 'acf'), 'not_found' => __('No Field Groups found', 'acf'), 'not_found_in_trash' => __('No Field Groups found in Trash', 'acf')), 'public' => false, 'show_ui' => true, '_builtin' => false, 'capability_type' => 'post', 'capabilities' => array('edit_post' => $cap, 'delete_post' => $cap, 'edit_posts' => $cap, 'delete_posts' => $cap), 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'supports' => array('title'), 'show_in_menu' => false)); // Create post type 'acf-field' register_post_type('acf-field', array('labels' => array('name' => __('Fields', 'acf'), 'singular_name' => __('Field', 'acf'), 'add_new' => __('Add New', 'acf'), 'add_new_item' => __('Add New Field', 'acf'), 'edit_item' => __('Edit Field', 'acf'), 'new_item' => __('New Field', 'acf'), 'view_item' => __('View Field', 'acf'), 'search_items' => __('Search Fields', 'acf'), 'not_found' => __('No Fields found', 'acf'), 'not_found_in_trash' => __('No Fields found in Trash', 'acf')), 'public' => false, 'show_ui' => false, '_builtin' => false, 'capability_type' => 'post', 'capabilities' => array('edit_post' => $cap, 'delete_post' => $cap, 'edit_posts' => $cap, 'delete_posts' => $cap), 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'supports' => array('title'), 'show_in_menu' => false)); // append scripts $scripts['select2'] = array('src' => acf_get_dir("assets/inc/select2/select2{$min}.js"), 'deps' => array('jquery')); $scripts['acf-input'] = array('src' => acf_get_dir("assets/js/acf-input{$min}.js"), 'deps' => array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-resizable', 'jquery-ui-datepicker', 'wp-color-picker', 'select2')); $scripts['acf-field-group'] = array('src' => acf_get_dir("assets/js/acf-field-group{$min}.js"), 'deps' => array('acf-input')); // select2-l10n if ($lang) { // vars $lang = str_replace('_', '-', $lang); $lang_code = substr($lang, 0, 2); $src = ''; // attempt 1 if (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang_code}.js"))) { $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang_code}.js"); } elseif (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang}.js"))) { $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang}.js"); } // only append if file exists if ($src) { // append script $scripts['select2-l10n'] = array('src' => $src, 'deps' => array('select2')); // append dep $scripts['acf-input']['deps'][] = 'select2-l10n'; } } // register scripts foreach ($scripts as $handle => $script) { wp_register_script($handle, $script['src'], $script['deps'], $version); } // append styles $styles['select2'] = array('src' => acf_get_dir('assets/inc/select2/select2.css'), 'deps' => false); $styles['acf-datepicker'] = array('src' => acf_get_dir('assets/inc/datepicker/jquery-ui-1.10.4.custom.min.css'), 'deps' => false); $styles['acf-global'] = array('src' => acf_get_dir('assets/css/acf-global.css'), 'deps' => false); $styles['acf-input'] = array('src' => acf_get_dir('assets/css/acf-input.css'), 'deps' => array('acf-global', 'wp-color-picker', 'select2', 'acf-datepicker')); $styles['acf-field-group'] = array('src' => acf_get_dir('assets/css/acf-field-group.css'), 'deps' => array('acf-input')); // register styles foreach ($styles as $handle => $style) { wp_register_style($handle, $style['src'], $style['deps'], $version); } // complete loading of ACF files $this->complete(); }
function register_assets() { // vars $version = acf_get_setting('version'); $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; // scripts wp_register_script('acf-input', acf_get_dir("assets/js/acf-input{$min}.js"), array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-resizable'), $version); wp_register_script('acf-field-group', acf_get_dir("assets/js/acf-field-group{$min}.js"), array('acf-input'), $version); // styles wp_register_style('acf-global', acf_get_dir('assets/css/acf-global.css'), array(), $version); wp_register_style('acf-input', acf_get_dir('assets/css/acf-input.css'), array('acf-global'), $version); wp_register_style('acf-field-group', acf_get_dir('assets/css/acf-field-group.css'), array('acf-input'), $version); }
function register_assets() { // vars $version = acf_get_setting('version'); $lang = get_locale(); $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; $scripts = array(); $styles = array(); // append scripts $scripts['select2'] = array('src' => acf_get_dir("assets/inc/select2/select2{$min}.js"), 'deps' => array('jquery')); $scripts['acf-input'] = array('src' => acf_get_dir("assets/js/acf-input{$min}.js"), 'deps' => array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-resizable', 'jquery-ui-datepicker', 'wp-color-picker', 'select2')); $scripts['acf-field-group'] = array('src' => acf_get_dir("assets/js/acf-field-group{$min}.js"), 'deps' => array('acf-input')); // select2-l10n if ($lang) { // vars $lang = str_replace('_', '-', $lang); $lang_code = substr($lang, 0, 2); $src = ''; // attempt 1 if (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang_code}.js"))) { $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang_code}.js"); } elseif (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang}.js"))) { $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang}.js"); } // only append if file exists if ($src) { // append script $scripts['select2-l10n'] = array('src' => $src, 'deps' => array('select2')); // append dep $scripts['acf-input']['deps'][] = 'select2-l10n'; } } // register scripts foreach ($scripts as $handle => $script) { wp_register_script($handle, $script['src'], $script['deps'], $version); } // append styles $styles['select2'] = array('src' => acf_get_dir('assets/inc/select2/select2.css'), 'deps' => false); $styles['acf-datepicker'] = array('src' => acf_get_dir('assets/inc/datepicker/jquery-ui-1.10.4.custom.min.css'), 'deps' => false); $styles['acf-global'] = array('src' => acf_get_dir('assets/css/acf-global.css'), 'deps' => false); $styles['acf-input'] = array('src' => acf_get_dir('assets/css/acf-input.css'), 'deps' => array('acf-global', 'wp-color-picker', 'select2', 'acf-datepicker')); $styles['acf-field-group'] = array('src' => acf_get_dir('assets/css/acf-field-group.css'), 'deps' => array('acf-input')); // register styles foreach ($styles as $handle => $style) { wp_register_style($handle, $style['src'], $style['deps'], $version); } }
function enqueue_assets() { // vars $version = '3.5.2'; $lang = get_locale(); $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; // v4 /* wp_enqueue_script('select2', acf_get_dir("assets/inc/select2/dist/js/select2.full.js"), array('jquery'), '4.0', true ); wp_enqueue_style('select2', acf_get_dir("assets/inc/select2/dist/css/select2{$min}.css"), '', '4.0' ); return; */ // scripts wp_enqueue_script('select2', acf_get_dir("assets/inc/select2/select2{$min}.js"), array('jquery'), $version, true); // styles wp_enqueue_style('select2', acf_get_dir('assets/inc/select2/select2.css'), '', $version); // bail early if no language if (!$lang) { return; } // vars $lang = str_replace('_', '-', $lang); $lang_code = substr($lang, 0, 2); $src = ''; // attempt 1 if (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang_code}.js"))) { $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang_code}.js"); } elseif (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang}.js"))) { $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang}.js"); } // bail early if no language if (!$src) { return; } // scripts wp_enqueue_script('select2-l10n', $src, '', $version, true); }
function wp_init() { // vars $cap = acf_get_setting('capability'); $version = acf_get_setting('version'); $lang = get_locale(); $scripts = array(); $styles = array(); $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; // redeclare dir - allow another plugin to modify dir (maybe force SSL) acf_update_setting('dir', plugin_dir_url(__FILE__)); // set text domain load_textdomain('acf', acf_get_path('lang/acf-' . get_locale() . '.mo')); $my_register_post_type = 'register_' . 'post_type'; $my_register_post_type('acf-field-group', array('labels' => array('name' => __('Field Groups', 'acf'), 'singular_name' => __('Field Group', 'acf'), 'add_new' => __('Add New', 'acf'), 'add_new_item' => __('Add New Field Group', 'acf'), 'edit_item' => __('Edit Field Group', 'acf'), 'new_item' => __('New Field Group', 'acf'), 'view_item' => __('View Field Group', 'acf'), 'search_items' => __('Search Field Groups', 'acf'), 'not_found' => __('No Field Groups found', 'acf'), 'not_found_in_trash' => __('No Field Groups found in Trash', 'acf')), 'public' => false, 'show_ui' => true, '_builtin' => false, 'capability_type' => 'post', 'capabilities' => array('edit_post' => $cap, 'delete_post' => $cap, 'edit_posts' => $cap, 'delete_posts' => $cap), 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'supports' => array('title'), 'show_in_menu' => false)); $my_register_post_type('acf-field', array('labels' => array('name' => __('Fields', 'acf'), 'singular_name' => __('Field', 'acf'), 'add_new' => __('Add New', 'acf'), 'add_new_item' => __('Add New Field', 'acf'), 'edit_item' => __('Edit Field', 'acf'), 'new_item' => __('New Field', 'acf'), 'view_item' => __('View Field', 'acf'), 'search_items' => __('Search Fields', 'acf'), 'not_found' => __('No Fields found', 'acf'), 'not_found_in_trash' => __('No Fields found in Trash', 'acf')), 'public' => false, 'show_ui' => false, '_builtin' => false, 'capability_type' => 'post', 'capabilities' => array('edit_post' => $cap, 'delete_post' => $cap, 'edit_posts' => $cap, 'delete_posts' => $cap), 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'supports' => array('title'), 'show_in_menu' => false)); /* // register post type 'acf-field-group' register_post_type('acf-field-group', array( 'labels' => array( 'name' => __( 'Field Groups', 'acf' ), 'singular_name' => __( 'Field Group', 'acf' ), 'add_new' => __( 'Add New' , 'acf' ), 'add_new_item' => __( 'Add New Field Group' , 'acf' ), 'edit_item' => __( 'Edit Field Group' , 'acf' ), 'new_item' => __( 'New Field Group' , 'acf' ), 'view_item' => __( 'View Field Group', 'acf' ), 'search_items' => __( 'Search Field Groups', 'acf' ), 'not_found' => __( 'No Field Groups found', 'acf' ), 'not_found_in_trash' => __( 'No Field Groups found in Trash', 'acf' ), ), 'public' => false, 'show_ui' => true, '_builtin' => false, 'capability_type' => 'post', 'capabilities' => array( 'edit_post' => $cap, 'delete_post' => $cap, 'edit_posts' => $cap, 'delete_posts' => $cap, ), 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'supports' => array('title'), 'show_in_menu' => false, )); // register post type 'acf-field' register_post_type('acf-field', array( 'labels' => array( 'name' => __( 'Fields', 'acf' ), 'singular_name' => __( 'Field', 'acf' ), 'add_new' => __( 'Add New' , 'acf' ), 'add_new_item' => __( 'Add New Field' , 'acf' ), 'edit_item' => __( 'Edit Field' , 'acf' ), 'new_item' => __( 'New Field' , 'acf' ), 'view_item' => __( 'View Field', 'acf' ), 'search_items' => __( 'Search Fields', 'acf' ), 'not_found' => __( 'No Fields found', 'acf' ), 'not_found_in_trash' => __( 'No Fields found in Trash', 'acf' ), ), 'public' => false, 'show_ui' => false, '_builtin' => false, 'capability_type' => 'post', 'capabilities' => array( 'edit_post' => $cap, 'delete_post' => $cap, 'edit_posts' => $cap, 'delete_posts' => $cap, ), 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'supports' => array('title'), 'show_in_menu' => false, )); */ // register post status register_post_status('acf-disabled', array('label' => __('Disabled', 'acf'), 'public' => true, 'exclude_from_search' => false, 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, 'label_count' => _n_noop('Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', 'acf'))); // append scripts $scripts['select2'] = array('src' => acf_get_dir("assets/inc/select2/select2{$min}.js"), 'deps' => array('jquery')); $scripts['acf-input'] = array('src' => acf_get_dir("assets/js/acf-input{$min}.js"), 'deps' => array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-resizable', 'jquery-ui-datepicker', 'wp-color-picker', 'select2')); $scripts['acf-field-group'] = array('src' => acf_get_dir("assets/js/acf-field-group{$min}.js"), 'deps' => array('acf-input')); // select2-l10n if ($lang) { // vars $lang = str_replace('_', '-', $lang); $lang_code = substr($lang, 0, 2); $src = ''; // attempt 1 if (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang_code}.js"))) { $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang_code}.js"); } elseif (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang}.js"))) { $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang}.js"); } // only append if file exists if ($src) { // append script $scripts['select2-l10n'] = array('src' => $src, 'deps' => array('select2')); // append dep $scripts['acf-input']['deps'][] = 'select2-l10n'; } } // register scripts foreach ($scripts as $handle => $script) { wp_register_script($handle, $script['src'], $script['deps'], $version); } // append styles $styles['select2'] = array('src' => acf_get_dir('assets/inc/select2/select2.css'), 'deps' => false); $styles['acf-datepicker'] = array('src' => acf_get_dir('assets/inc/datepicker/jquery-ui-1.10.4.custom.min.css'), 'deps' => false); $styles['acf-global'] = array('src' => acf_get_dir('assets/css/acf-global.css'), 'deps' => false); $styles['acf-input'] = array('src' => acf_get_dir('assets/css/acf-input.css'), 'deps' => array('acf-global', 'wp-color-picker', 'select2', 'acf-datepicker')); $styles['acf-field-group'] = array('src' => acf_get_dir('assets/css/acf-field-group.css'), 'deps' => array('acf-input')); // register styles foreach ($styles as $handle => $style) { wp_register_style($handle, $style['src'], $style['deps'], $version); } // complete loading of ACF files $this->complete(); }