/** * Enqueue admin scripts * * @since 0.1.0 */ function wp_user_profiles_admin_enqueue_scripts($hook = '') { // Bail if not the correct page if (!is_user_admin() && $GLOBALS['pagenow'] !== wp_user_profiles_get_file()) { return; } // Get hooknames $sections = wp_user_profiles_get_section_hooknames(); // Maybe manipulate the hook based on dashboard _wp_user_profiles_walk_section_hooknames($hook, ''); // Bail if not a user profile section if (!in_array($hook, $sections, true)) { return; } // Enqueue core scripts wp_enqueue_script('jquery-ui-sortable'); wp_enqueue_script('postbox'); wp_enqueue_script('dashboard'); // Set location & version for scripts & styles $src = wp_user_profiles_get_plugin_url(); $ver = wp_user_profiles_get_asset_version(); // Styles wp_enqueue_style('wp-user-profiles', $src . 'assets/css/user-profiles.css', array('dashboard'), $ver); // Ugh... this is terrible wp_enqueue_script('user-profile', $src . 'assets/css/user-profiles.css', array('jquery', 'password-strength-meter', 'wp-util'), $ver); wp_scripts()->registered['user-profile']->src = $src . 'assets/js/user-profiles.js'; }
/** * Enqueue admin scripts * * @since 0.1.0 */ function wp_user_profiles_admin_enqueue_scripts() { // Enqueue core scripts wp_enqueue_script('jquery-ui-sortable'); wp_enqueue_script('postbox'); wp_enqueue_script('dashboard'); // Set location & version for scripts & styles $src = wp_user_profiles_get_plugin_url(); $ver = wp_user_profiles_get_asset_version(); // Styles wp_enqueue_style('wp-user-profiles', $src . 'assets/css/user-profiles.css', array(), $ver); // Ugh... this is terrible wp_enqueue_script('user-profile', $src . 'assets/css/user-profiles.css', array('jquery', 'dashboard', 'password-strength-meter', 'wp-util'), $ver); wp_scripts()->registered['user-profile']->src = $src . 'assets/js/user-profiles.js'; }