/** * Enqueue scripts */ public function admin_scripts() { global $wp_query, $post; $screen = get_current_screen(); // Register scripts wp_register_script('chosen', SP()->plugin_url() . '/assets/js/chosen.jquery.min.js', array('jquery'), '1.1.0', true); wp_register_script('jquery-tiptip', SP()->plugin_url() . '/assets/js/jquery.tipTip.min.js', array('jquery'), '1.3', true); wp_register_script('jquery-caret', SP()->plugin_url() . '/assets/js/jquery.caret.min.js', array('jquery'), '1.02', true); wp_register_script('jquery-countdown', SP()->plugin_url() . '/assets/js/jquery.countdown.min.js', array('jquery'), '2.0.2', true); wp_register_script('jquery-fitvids', SP()->plugin_url() . '/assets/js/jquery.fitvids.js', array('jquery'), '1.1', true); wp_register_script('google-maps', 'http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places'); wp_register_script('jquery-locationpicker', SP()->plugin_url() . '/assets/js/locationpicker.jquery.js', array('jquery', 'google-maps'), '0.1.6', true); wp_register_script('sportspress-admin-locationpicker', SP()->plugin_url() . '/assets/js/admin/locationpicker.js', array('jquery', 'google-maps', 'jquery-locationpicker'), SP_VERSION, true); wp_register_script('sportspress-admin-equationbuilder', SP()->plugin_url() . '/assets/js/admin/equationbuilder.js', array('jquery', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-droppable'), SP_VERSION, true); wp_register_script('sportspress-admin-widgets', SP()->plugin_url() . '/assets/js/admin/widgets.js', array('jquery'), SP_VERSION, true); // SportsPress admin pages if (in_array($screen->id, sp_get_screen_ids()) || strpos($screen->id, 'sportspress-config')) { wp_enqueue_script('jquery'); wp_enqueue_script('chosen'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-draggable'); wp_enqueue_script('jquery-ui-droppable'); wp_enqueue_script('jquery-ui-sortable'); wp_enqueue_script('jquery-tiptip'); wp_enqueue_script('jquery-caret'); wp_enqueue_script('jquery-countdown'); wp_enqueue_script('jquery-fitvids'); wp_enqueue_script('sportspress-admin', SP()->plugin_url() . '/assets/js/admin/sportspress-admin.js', array('jquery', 'chosen', 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-tiptip', 'jquery-caret', 'jquery-countdown', 'jquery-fitvids'), SP_VERSION, true); $strings = array('none' => __('None', 'sportspress'), 'remove_text' => __('— Remove —', 'sportspress'), 'days' => __('days', 'sportspress'), 'hrs' => __('hrs', 'sportspress'), 'mins' => __('mins', 'sportspress'), 'secs' => __('secs', 'sportspress'), 'displaying_posts' => html_entity_decode(__('Displaying %s–%s of %s', 'sportspress'))); // Localize scripts wp_localize_script('sportspress-admin', 'localized_strings', $strings); } if (in_array($screen->id, array('widgets'))) { wp_enqueue_script('sportspress-admin-widgets'); } // Edit venue pages if (in_array($screen->id, array('edit-sp_venue'))) { wp_enqueue_script('google-maps'); wp_enqueue_script('jquery-locationpicker'); wp_enqueue_script('sportspress-admin-locationpicker'); } // Edit equation if (in_array($screen->id, array('sp_column', 'sp_statistic'))) { wp_enqueue_script('sportspress-admin-equationbuilder'); } }
/** * Enqueue styles */ public function admin_styles() { $screen = get_current_screen(); if (in_array($screen->id, sp_get_screen_ids())) { wp_enqueue_style('prosports-team-colors-admin', SP_TEAM_COLORS_URL . 'css/admin.css', array(), SP_TEAM_COLORS_VERSION); } }