/** * @param $icon_value * @param bool $icon_styles * * @return bool|string */ function siteorigin_widget_get_icon($icon_value, $icon_styles = false) { if (empty($icon_value)) { return false; } list($family, $icon) = explode('-', $icon_value, 2); if (empty($family) || empty($icon)) { return false; } static $widget_icon_families; static $widget_icons_enqueued = array(); if (empty($widget_icon_families)) { $widget_icon_families = apply_filters('siteorigin_widgets_icon_families', array()); } if (empty($widget_icon_families[$family]) || empty($widget_icon_families[$family]['icons'][$icon])) { return false; } if (empty($widget_icons_enqueued[$family]) && !empty($widget_icon_families[$family]['style_uri'])) { if (!wp_style_is('siteorigin-widget-icon-font-' . $family)) { wp_enqueue_style('siteorigin-widget-icon-font-' . $family, $widget_icon_families[$family]['style_uri']); } return '<span class="sow-icon-' . esc_attr($family) . '" data-sow-icon="' . $widget_icon_families[$family]['icons'][$icon] . '" ' . (!empty($icon_styles) ? 'style="' . implode('; ', $icon_styles) . '"' : '') . '></span>'; } else { return false; } }
function cr_styles_scripts() { if (is_singular('reports')) { wp_register_style('cap-reports-theme-compat', plugin_dir_url(__FILE__) . 'css/cap-reports-theme-support.css'); wp_register_style('cap-reports-full', plugin_dir_url(__FILE__) . 'css/cap-reports-full.css'); // Check to see if the current theme has support for cap-reports // This can be delcared on a theme by declaring add_theme_support('cap-reports'); in functions.php if (current_theme_supports('cap-reports')) { wp_enqueue_style('cap-reports-theme-compat'); } else { wp_enqueue_style('cap-reports-full'); } if (!wp_style_is('mdi', 'enqueued')) { wp_enqueue_style('mdi', plugin_dir_url(__FILE__) . 'bower_components/mdi/css/materialdesignicons.min.css'); } // We need to check for enquire js and vide before enqueuing wp_enqueue_script('cap-reports', plugin_dir_url(__FILE__) . 'js/cap-reports.js', array('jquery'), '20150210', true); if (!wp_script_is('vide', 'enqueued')) { wp_enqueue_script('vide', plugin_dir_url(__FILE__) . 'bower_components/vide/dist/jquery.vide.min.js', array('jquery'), '20150210', true); } if (!wp_script_is('enquire.js', 'enqueued')) { wp_enqueue_script('enquire.js', plugin_dir_url(__FILE__) . 'bower_components/enquire/dist/enquire.min.js', array('jquery'), '20150210', true); } } }
function test_it_can_enqueue_style() { $this->stylesheet->slug = 'foo'; $this->stylesheet->register(); $this->stylesheet->enqueue(); $this->assertTrue(wp_style_is('foo', 'enqueued')); }
function jetpack_register_social_logos() { if (!wp_style_is('social-logos', 'registered')) { $post_fix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; wp_register_style('social-logos', plugins_url('social-logos/social-logos' . $post_fix . '.css', __FILE__), false, '1'); } }
/** * Load settings JS & CSS * @return void */ public function settings_assets() { // Scripts & Styles for Color Picker $cpscript = 'farbtastic'; $cpstyle = 'farbtastic'; $list = 'enqueued'; if (wp_script_is($cpscript, $list)) { return; } else { wp_enqueue_script('farbtastic'); } if (wp_style_is($cpstyle, $list)) { return; } else { wp_enqueue_style('farbtastic'); } // Custom AMD Scripts $amdadminjs = 'wfm-admin-js'; if (wp_script_is($amdadminjs, $list)) { return; } else { wp_register_script('wfm-admin-js', $this->plugin_url . '/am-wcslider-admin-scripts.js', array('farbtastic', 'jquery'), '1.0.0'); wp_enqueue_script('wfm-admin-js'); } }
function zerowp_customizer_enqueue_font($option) { $font_name = get_theme_mod($option); if (empty($font_name)) { $font_name = 'Arial'; } if (!in_array($font_name, zerowp_customizer_standard_fonts())) { $font_weight = get_theme_mod($option . '_weight', 400); $font_weight = !empty($font_weight) ? $font_weight : 400; $font_weight_in_url = !in_array(absint($font_weight), array(400, 700)) ? '400,700,' . $font_weight : '400,700'; $font_name = trim($font_name); $handle = 'google_font_' . str_ireplace(' ', '_', $font_name); if (!wp_style_is($handle, 'enqueued')) { wp_register_style($handle, "//fonts.googleapis.com/css?family=" . str_ireplace(' ', '+', $font_name) . ":" . $font_weight_in_url); wp_enqueue_style($handle); } else { $registered_link = wp_styles()->query($handle)->src; if (strpos($registered_link, (string) $font_weight) === false) { wp_deregister_style($handle); wp_register_style($handle, $registered_link . ',' . $font_weight); wp_enqueue_style($handle); } } } }
/** * Enqueue scripts and styles. * * @since 1.0 */ function bigboom_enqueue_scripts() { /* Register and enqueue styles */ wp_register_style('bb-icons', THEME_URL . '/css/icons.min.css', array(), THEME_VERSION); wp_register_style('bootstrap', THEME_URL . '/css/bootstrap.min.css', array(), '3.3.2'); wp_register_style('google-fonts', '//fonts.googleapis.com/css?family=Montserrat:400,700|Raleway:300,500,600,700,400'); if (!wp_style_is('js_composer_front', 'enqueued') && wp_style_is('js_composer_front', 'registered')) { wp_enqueue_style('js_composer_front'); } wp_enqueue_style('bigboom', get_stylesheet_uri(), array('google-fonts', 'bootstrap', 'bb-icons'), THEME_VERSION); // Load custom color scheme file if (intval(bigboom_theme_option('custom_color_scheme')) && bigboom_theme_option('custom_color_1')) { $upload_dir = wp_upload_dir(); $dir = path_join($upload_dir['baseurl'], 'custom-css'); $file = $dir . '/color-scheme.css'; wp_enqueue_style('bigboom-color-scheme', $file, THEME_VERSION); } /** Register and enqueue scripts */ $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; wp_register_script('jquery-tabs', THEME_URL . '/js/jquery.tabs.js', array('jquery'), '1.0.0', true); wp_register_script('bigboom-plugins', THEME_URL . "/js/plugins{$min}.js", array('jquery'), THEME_VERSION, true); wp_enqueue_script('bigboom', THEME_URL . "/js/scripts{$min}.js", array('bigboom-plugins'), THEME_VERSION, true); wp_localize_script('bigboom', 'bigboom', array('ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('_bigboom_nonce'), 'direction' => is_rtl() ? 'rtl' : '')); if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } }
/** * @since 4.3.0 * @depends test_valid_constructor */ public function test_enqueue_scripts_styles() { $this->_eeAdminHookMock->enqueue_scripts_styles(); $this->assertTrue(wp_style_is('test-css', 'registered')); $this->assertTrue(wp_style_is('test-css')); $this->assertFalse(wp_style_is('event-editor-css', 'registered')); $this->assertTrue(wp_script_is('test-js', 'registered')); $this->assertTrue(wp_script_is('test-js')); //test exception if no registers index in _scripts_styles property. $scripts_styles_cache = $this->_eeAdminHookMock->get_property('_scripts_styles'); //let's set a scripts styles array with no registers. $new_scripts_styles['something'] = 'fail'; $this->_eeAdminHookMock->set_property('_scripts_styles', $new_scripts_styles); $this->setExpectedException('EE_Error'); $this->_eeAdminHookMock->enqueue_scripts_styles(); //test for exception with missing params $this->_eeAdminHookMock->set_property('_scripts_styles', $scripts_styles_cache); $new_scripts_styles = $scripts_styles_cache; unset($new_scripts_styles['registers']['test-css']['url']); $this->_eeAdminHookMock->set_property('_scripts_styles', $new_scripts_styles); $this->setExpectedException('EE_Error'); $this->_eeAdminHookMock->enqueue_scripts_styles(); //restore correct scripts styles $this->_eeAdminHookMock->set_property('_scripts_styles', $scripts_styles_cache); }
public function registration($params) { // Loading scripts and styles only when required /* Password Stregth Checker Script */ if (!wp_script_is('form-validate')) { wp_register_script('form-validate', upme_url . 'js/form-validate.js', array('jquery')); wp_enqueue_script('form-validate'); $validate_strings = upme_form_validate_setting(); wp_localize_script('form-validate', 'Validate', $validate_strings); } // Include password strength meter from WordPress core wp_enqueue_script('password-strength-meter'); if (!wp_style_is('upme_password_meter')) { wp_register_style('upme_password_meter', upme_url . 'css/password-meter.css'); wp_enqueue_style('upme_password_meter'); } if (!wp_style_is('upme_date_picker')) { wp_register_style('upme_date_picker', upme_url . 'css/upme-datepicker.css'); wp_enqueue_style('upme_date_picker'); } if (!wp_script_is('upme_date_picker_js')) { wp_register_script('upme_date_picker_js', upme_url . 'js/upme-datepicker.js', array('jquery')); wp_enqueue_script('upme_date_picker_js'); // Set date picker default settings $date_picker_array = upme_date_picker_setting(); wp_localize_script('upme_date_picker_js', 'UPMEDatePicker', $date_picker_array); } do_action('upme_add_registration_scripts'); }
public static function enqueue() { $image_util_support = get_theme_support('pls-image-util'); if (!wp_script_is('pls-image-util-fancybox', 'registered')) { wp_register_script('pls-image-util-fancybox', trailingslashit(PLS_EXT_URL) . 'image-util/fancybox/jquery.fancybox-1.3.4.pack.js', array('jquery'), NULL, true); } if (!wp_script_is('pls-image-util-fancybox-default-settings', 'registered')) { wp_register_script('pls-image-util-fancybox-default-settings', trailingslashit(PLS_EXT_URL) . 'image-util/fancybox/default-settings.js', array('jquery'), NULL, true); } if (!wp_style_is('pls-image-util-fancybox-style', 'registered')) { wp_register_style('pls-image-util-fancybox-style', trailingslashit(PLS_EXT_URL) . 'image-util/fancybox/jquery.fancybox-1.3.4.css'); } if (is_array($image_util_support)) { if (in_array('fancybox', $image_util_support[0])) { if (!wp_script_is('pls-image-util-fancybox', 'queue')) { wp_enqueue_script('pls-image-util-fancybox'); } if (!wp_script_is('pls-image-util-fancybox-default-settings', 'queue')) { wp_enqueue_script('pls-image-util-fancybox-default-settings'); } if (!wp_style_is('pls-image-util-fancybox-style', 'queue')) { wp_enqueue_style('pls-image-util-fancybox-style'); } } return; } }
function enqueue_pro_lightbox_resources($displayed_gallery = FALSE) { $settings = C_NextGen_Settings::get_instance(); if ($settings->thumbEffect == NGG_PRO_LIGHTBOX) { $router = C_Router::get_instance(); if (!self::$run_once) { // ensure the gallery exists if ($displayed_gallery && $displayed_gallery->id()) { $this->object->_add_script_data('ngg_common', 'galleries.gallery_' . $displayed_gallery->id() . '.wordpress_page_root', get_permalink(), FALSE); } wp_enqueue_script('underscore'); wp_enqueue_script('backbone'); wp_enqueue_script('velocity', $router->get_static_url('photocrati-nextgen_pro_lightbox_legacy#velocity.min.js')); wp_enqueue_script('galleria', $router->get_static_url('photocrati-galleria#galleria-1.4.2.min.js')); wp_enqueue_style('ngg_pro_lightbox_theme_css', $router->get_static_url('photocrati-nextgen_pro_lightbox_legacy#theme/galleria.nextgen_pro_lightbox.css')); wp_enqueue_script('ngg_pro_lightbox_theme_js', $router->get_static_url('photocrati-nextgen_pro_lightbox_legacy#theme/galleria.nextgen_pro_lightbox.js'), 'galleria'); if (!wp_style_is('fontawesome', 'registered')) { C_Display_Type_Controller::get_instance()->enqueue_displayed_gallery_trigger_buttons_resources(); } wp_enqueue_style('fontawesome'); // retrieve the lightbox so we can examine its settings $mapper = C_Lightbox_Library_Mapper::get_instance(); $library = $mapper->find_by_name(NGG_PRO_LIGHTBOX, TRUE); $library->display_settings += array('is_front_page' => is_front_page() ? 1 : 0, 'share_url' => $router->get_url('/nextgen-share/{gallery_id}/{image_id}/{named_size}', TRUE, 'root'), 'protect_images' => !empty($settings->protect_images) ? TRUE : FALSE, 'style' => str_replace('.css', '', $library->display_settings['style']), 'i18n' => array('toggle_social_sidebar' => __('Toggle social sidebar', 'nextgen-gallery-pro'), 'play_pause' => __('Play / Pause', 'nextgen-gallery-pro'), 'toggle_fullscreen' => __('Toggle fullscreen', 'nextgen-gallery-pro'), 'toggle_image_info' => __('Toggle image info', 'nextgen-gallery-pro'), 'close_window' => __('Close window', 'nextgen-gallery-pro'), 'share' => array('twitter' => __('Share on Twitter', 'nextgen-gallery-pro'), 'googlep' => __('Share on Google+', 'nextgen-gallery-pro'), 'facebook' => __('Share on Facebook', 'nextgen-gallery-pro'), 'pinterest' => __('Share on Pinterest', 'nextgen-gallery-pro')))); // provide the current language so ajax requests can request translations in the same locale if (defined('ICL_LANGUAGE_CODE')) { $library->display_settings['lang'] = $router->param('lang', NULL, FALSE) ? $router->param('lang') : ICL_LANGUAGE_CODE; } wp_localize_script('photocrati_ajax', 'nplModalSettings', $library->display_settings); } self::$run_once = TRUE; } }
/** * Enqueue scripts and styles. */ public static function enqueue($element = null) { global $groups_version; switch ($element) { case 'select': switch (self::$select) { case 'chosen': if (!wp_script_is('chosen')) { wp_enqueue_script('chosen', GROUPS_PLUGIN_URL . 'js/chosen/chosen.jquery.min.js', array('jquery'), $groups_version, false); } if (!wp_style_is('chosen')) { wp_enqueue_style('chosen', GROUPS_PLUGIN_URL . 'css/chosen/chosen.min.css', array(), $groups_version); } break; case 'selectize': if (!wp_script_is('selectize')) { wp_enqueue_script('selectize', GROUPS_PLUGIN_URL . 'js/selectize/selectize.min.js', array('jquery'), $groups_version, false); } if (!wp_style_is('selectize')) { wp_enqueue_style('selectize', GROUPS_PLUGIN_URL . 'css/selectize/selectize.bootstrap2.css', array(), $groups_version); } break; } break; } }
public function enqueueStyles() { if (wp_style_is('wptoolset-field-date', 'enqueued')) { return; } wp_enqueue_style('wptoolset-field-date'); }
public function enqueueScripts() { foreach ($this->getScripts() as $script) { $script = is_array($script) ? $script : ['file' => $script]; if ($script['file'] = $this->getScriptPath($script['file'])) { $info = pathinfo($script['file']); $extension = !empty($info['extension']) ? $info['extension'] : (!empty($script['type']) ? $script['type'] : false); switch ($extension) { case 'css': $script = array_merge(array('dependencies' => array(), 'version' => '1.0.0', 'media' => 'all', 'enqueue' => true), $script, array('handle' => !empty($script['handle']) ? $script['handle'] : $info['filename'])); if (wp_style_is($script['handle'], 'registered')) { wp_deregister_style($script['handle']); } wp_register_style($script['handle'], $script['file'], $script['dependencies'], $script['version'], $script['media']); if ($script['enqueue']) { wp_enqueue_style($script['handle']); } break; default: $script = array_merge(array('dependencies' => array(), 'version' => '1.0.0', 'in_footer' => true, 'localize' => false, 'enqueue' => true), $script, array('handle' => !empty($script['handle']) ? $script['handle'] : $info['filename'])); if (wp_script_is($script['handle'], 'registered')) { wp_deregister_script($script['handle']); } wp_register_script($script['handle'], $script['file'], $script['dependencies'], $script['version'], $script['in_footer']); if ($script['localize']) { wp_localize_script($script['handle'], $script['localize']['name'], $script['localize']['data']); } if ($script['enqueue']) { wp_enqueue_script($script['handle']); } break; } } } }
/** * Enqueue all scripts and styles needed when viewing the backend. * * @see http://codex.wordpress.org/Function_Reference/wp_style_is * @see http://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/ * @see http://ottopress.com/2010/passing-parameters-from-php-to-javascripts-in-plugins/ * @see http://codex.wordpress.org/Function_Reference/wp_localize_script * @since 1.0 */ public function enqueue($hook_suffix) { $min = SCRIPT_DEBUG ? '' : '.min'; // just required on options-media.php and would produce errors pre WordPress 3.1 if ($hook_suffix == 'options-media.php' && get_bloginfo('version') >= 3.1) { if (wp_style_is('wp-color-picker', 'registered')) { // >=WP3.5 wp_enqueue_style('wp-color-picker'); wp_enqueue_script('fvp_backend_35', FVP_URL . 'js/backend_35.js', array('wp-color-picker', 'jquery'), FVP_VERSION); } else { // <WP3.5, fallback for the new WordPress Color Picker which was added in 3.5 wp_enqueue_style('farbtastic'); wp_enqueue_script('farbtastic'); wp_enqueue_script('fvp_backend_pre35', FVP_URL . 'js/backend_pre35.js', array('jquery'), FVP_VERSION); } wp_enqueue_script('fvp_settings', FVP_URL . 'js/settings.js', array('jquery'), FVP_VERSION); } // just required on post.php and post-new.php if ($hook_suffix == 'post.php' && isset($_GET['post']) || $hook_suffix == 'post-new.php') { wp_enqueue_script('jquery.autosize', FVP_URL . "js/jquery.autosize{$min}.js", array('jquery'), FVP_VERSION); wp_enqueue_script('fvp_backend', FVP_URL . "js/backend{$min}.js", array('jquery', 'jquery.autosize'), FVP_VERSION); wp_enqueue_style('wp-mediaelement'); wp_enqueue_script('wp-mediaelement'); $options = get_option('fvp-settings'); $upload_dir = wp_upload_dir(); wp_localize_script('fvp_backend', 'fvp_backend_data', array('wp_upload_dir' => $upload_dir['baseurl'], 'loading_gif' => get_admin_url(null, 'images/loading.gif'), 'default_value' => $this->default_value, 'default_value_sec' => $this->default_value_sec, 'wp_35' => get_bloginfo('version') >= 3.5)); } if ($hook_suffix == 'options-media.php' || ($hook_suffix == 'post.php' && isset($_GET['post']) || $hook_suffix == 'post-new.php')) { wp_enqueue_style('fvp_backend', FVP_URL . "css/backend{$min}.css", array(), FVP_VERSION); } }
/** * adds user's twitter profile link to their bio, wherever it is displayed * * @since 0.0.1 * @param string $description * @return string $description + twitter link */ function add_twitter_link_to_bio($description) { // this should normalize most instances of full or partial url, @username, etc., to username only $username = preg_replace('#https?://|twitter.com/|@#', '', get_the_author_meta('twitter')); if (!$username) { // return early if no twitter username return $description; } // build twitter URL from username $href = 'https://twitter.com/' . $username; // link title, translated: 'Follow (Author Name) on Twitter' $title = esc_attr(sprintf(__('Follow %s on Twitter'), get_the_author())); /** * if genericons is enqueued, let's add a twitter icon! for fun. * * trying to be as design-agnostic as possible here, but genericons are by * default given font-size: 16px; i'd rather make that 1em, since this use * is inline w text, at different sizes throughout the theme */ $icon = wp_style_is('genericons') ? '<i class="genericon genericon-twitter" style="font-size:inherit;line-height:inherit"></i>' : ''; // that WAS fun /** * build output. * still trying to be unopinionated but also would like for it to look good * out of the box, and inserting a couple of spaces matches the output of * twentyfifteen's other author links looks p good to me */ $twitter_link = sprintf(' <a class="author-link twitter-link" href="%s" title="%s">%s @%s </a>', $href, $title, $icon, $username); // finally, return return $description . $twitter_link; }
public function _actionScriptsAndStyles() { if (!wp_script_is('views-shortcodes-gui-script')) { wp_enqueue_script('views-shortcodes-gui-script'); } if (!wp_script_is('jquery-ui-resizable')) { wp_enqueue_script('jquery-ui-resizable'); } if (!wp_style_is('views-admin-css')) { wp_enqueue_style('views-admin-css'); } if (!wp_script_is('views-codemirror-conf-script')) { wp_enqueue_script('views-codemirror-conf-script'); } if (!wp_style_is('toolset-meta-html-codemirror-css')) { wp_enqueue_style('toolset-meta-html-codemirror-css'); } if (!wp_script_is('views-embedded-script')) { wp_enqueue_script('views-embedded-script'); } if (!wp_script_is('views-utils-script')) { wp_enqueue_script('views-utils-script'); } wp_enqueue_style('toolset-user-editors-ressource-views-dialog', TOOLSET_COMMON_URL . '/user-editors/resource/views/dialog/dialog.css', array(), TOOLSET_COMMON_VERSION); }
/** * @covers Dynamic_Featured_Image::enqueue_admin_scripts */ public function testEnqueueAdminScripts() { $this->_dfi->enqueue_admin_scripts(); $this->assertTrue(wp_script_is('scripts-dfi')); $this->assertTrue(wp_style_is('style-dfi')); $this->assertTrue(wp_style_is('dashicons')); }
public function __construct() { include_once 'gam-event-manager-cpt.php'; include_once 'gam-event-manager-settings.php'; include_once 'gam-event-manager-writepanels.php'; include_once 'gam-event-manager-setup.php'; $this->settings_page = new GAM_Event_Manager_Settings(); add_action('admin_menu', array($this, 'admin_menu'), 12); add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); } /** * admin_enqueue_scripts function. * * @access public * @return void */ public function admin_enqueue_scripts() { global $wp_scripts; $screen = get_current_screen(); //main frontend, bootstrap & bootstrap calendar style wp_register_style('bootstrap-main-css', EVENT_MANAGER_PLUGIN_URL . '/assets/js/bootstrap/css/bootstrap.min.css'); wp_register_style('bootstrap-datetime-picker-css', EVENT_MANAGER_PLUGIN_URL . '/assets/js/bootstrap-datetime-picker/bootstrap-datetimepicker.min.css'); if (!wp_style_is('bootstrap.min.css', 'enqueued')) { wp_enqueue_style('bootstrap-main-css'); } if (!wp_script_is('bootstrap-datetimepicker.min.css', 'enqueued')) { wp_enqueue_style('bootstrap-datetime-picker-css'); } wp_enqueue_style('event_manager_admin_css', EVENT_MANAGER_PLUGIN_URL . '/assets/css/backend.css'); //bootstrap, moment and bootstrap calendar js wp_register_script('bootstrap-main-js', EVENT_MANAGER_PLUGIN_URL . '/assets/js/bootstrap/js/bootstrap.min.js', array('jquery'), EVENT_MANAGER_VERSION, true); wp_register_script('moment', EVENT_MANAGER_PLUGIN_URL . '/assets/js/bootstrap-datetime-picker/moment-with-locales.min.js', array('bootstrap-main-js'), EVENT_MANAGER_VERSION, true); wp_register_script('bootstrap-datetime-picker-js', EVENT_MANAGER_PLUGIN_URL . '/assets/js/bootstrap-datetime-picker/bootstrap-datetimepicker.min.js', array('moment'), EVENT_MANAGER_VERSION, true);
function test_subscription_style_not_enqueued() { update_option('webpush_subscription_button', false); $main = new WebPush_Main(); do_action('wp_enqueue_scripts'); $this->assertFalse(wp_style_is('subscription-button-style')); }
function sp_fa_icons($title, $item, $args, $depth) { if (!empty($item->fa_icon_class) and wp_style_is('font_awesome', $list = 'enqueued')) { $title = '<i class="' . $item->fa_icon_class . '"></i>'; } return $title; }
function test_it_can_enqueue_custom_style() { $this->stylesheet->slug = 'theme-custom'; $this->stylesheet->register(); $this->stylesheet->enqueue(); $this->assertTrue(wp_style_is('stylesheet-plugin-custom', 'enqueued')); }
/** * Get post specific CSS styles and paste it to head. * * @since 4.0.0 */ function cherry_post_inline_styles() { $post_id = get_queried_object_id(); $post_type = get_post_type($post_id); if (!$post_type || !post_type_supports($post_type, 'cherry-post-style')) { return; } if (wp_style_is(CHERRY_DYNAMIC_CSS_HANDLE, 'enqueued')) { $handle = CHERRY_DYNAMIC_CSS_HANDLE; } else { $cherry_styles = cherry_get_styles(); $handle = isset($cherry_styles['style']) ? $cherry_styles['style']['handle'] : false; } if (!$handle) { return; } $header_bg = cherry_current_page()->get_property('background', 'header'); if (!$header_bg) { return; } $custom_bg = cherry_get_background_css('.site-header', $header_bg); /** * Filter a custom background style. * * @since 4.0.0 * @param string $custom_bg Background style. * @param int $post_id The post ID. */ $custom_bg = apply_filters('cherry_post_inline_styles', $custom_bg, $post_id); if (!$custom_bg) { return; } wp_add_inline_style($handle, sanitize_text_field($custom_bg)); }
function enqueue_displayed_gallery_trigger_buttons_resources($displayed_gallery = FALSE) { if (!wp_style_is('fontawesome', 'registered')) { if (strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'microsoft-iis') !== FALSE) { wp_register_style('fontawesome', site_url('/?ngg_serve_fontawesome_css=1')); } else { $router = C_Component_Registry::get_instance()->get_utility('I_Router'); wp_register_style('fontawesome', $router->get_static_url('photocrati-nextgen_gallery_display#fontawesome/font-awesome.css')); } } if (!$this->run_once && !empty($displayed_gallery) && !empty($displayed_gallery->display_settings['ngg_triggers_display']) && $displayed_gallery->display_settings['ngg_triggers_display'] !== 'never') { $pro_active = FALSE; if (defined('NGG_PRO_PLUGIN_VERSION')) { $pro_active = 'NGG_PRO_PLUGIN_VERSION'; } if (defined('NEXTGEN_GALLERY_PRO_VERSION')) { $pro_active = 'NEXTGEN_GALLERY_PRO_VERSION'; } if (!empty($pro_active)) { $pro_active = constant($pro_active); } if (!is_admin() && (empty($pro_active) || version_compare($pro_active, '1.0.11') >= 0)) { wp_enqueue_style('fontawesome'); $this->run_once = TRUE; } } }
function wp_loaded() { $deps = null; if (wp_style_is('genericons', 'registered')) { $deps = array('genericons'); } wp_register_style('omnisearch-admin', plugins_url('omnisearch.css', __FILE__), $deps); }
private static function is_enqueued($handle, $list = 'enqueued', $is_script) { if ($is_script) { wp_script_is($handle, $list); } else { wp_style_is($handle, $list); } }
function test_construction_success() { $this->markTestIncomplete('Checks of admin script, style, and ajax are enqueued and regitered.'); $this->assertTrue(wp_script_is('jquery', 'enqueued')); $this->assertTrue(wp_script_is('itm_script', 'enqueued')); $this->assertTrue(wp_style_is('font-awesome', 'enqueued')); $this->assertTrue(wp_style_is('itm_style', 'enqueued')); }
public function test_enqueueStyles() { Elementor\Plugin::instance()->editor->enqueue_styles(); $styles = ['font-awesome', 'select2', 'elementor-icons', 'wp-auth-check', 'google-font-roboto', 'elementor-editor']; foreach ($styles as $style) { $this->assertTrue(wp_style_is($style)); } }
/** * Load script (css, js). * */ public function load_woo_slider_script() { wp_register_style('slider-styles', plugins_url('css/slider.css', __FILE__)); if (!wp_style_is('slider-styles')) { wp_enqueue_style('slider-styles'); } wp_enqueue_style('slider-styles'); }
/** * Function to include the styles */ function geo_ss4u_map_style() { if (!wp_style_is('style', 'registered')) { wp_register_style('gms-style', GEO_SS4U_MAP_URL . '/assets/css/gms-style.css', array(), GEO_SS4U_MAP_VERSION); wp_enqueue_style('gms-style'); wp_register_style('gms-style-chosen', GEO_SS4U_MAP_URL . '/assets/js/chosen/chosen.css', array(), GEO_SS4U_MAP_VERSION); wp_enqueue_style('gms-style-chosen'); } }