enqueue_style() 공개 메소드

Enqueues styles.
public enqueue_style ( string $style )
$style string The name of the style to enqueue.
예제 #1
0
 /**
  * Queue assets for taxonomy screens.
  *
  * @since 1.5.0
  */
 public function admin_enqueue_scripts()
 {
     $pagenow = $GLOBALS['pagenow'];
     if (!(self::is_term_edit($pagenow) || self::is_term_overview($pagenow))) {
         return;
     }
     $asset_manager = new WPSEO_Admin_Asset_Manager();
     $asset_manager->enqueue_style('scoring');
     $tag_id = filter_input(INPUT_GET, 'tag_ID');
     if (self::is_term_edit($pagenow) && !empty($tag_id)) {
         wp_enqueue_media();
         // Enqueue files needed for upload functionality.
         $asset_manager->enqueue_style('metabox-css');
         $asset_manager->enqueue_style('snippet');
         $asset_manager->enqueue_style('scoring');
         wp_editor('', 'description');
         $asset_manager->enqueue_script('metabox');
         $asset_manager->enqueue_script('term-scraper');
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'term-scraper', 'wpseoTermScraperL10n', $this->localize_term_scraper_script());
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'replacevar-plugin', 'wpseoReplaceVarsL10n', $this->localize_replace_vars_script());
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoSelect2Locale', substr(get_locale(), 0, 2));
         $asset_manager->enqueue_script('admin-media');
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', array('choose_image' => __('Use Image', 'wordpress-seo')));
     }
 }
예제 #2
0
 /**
  * For WP versions older than 4.2, this includes styles and a script to make notices dismissible.
  */
 public function enqueue_dismissible()
 {
     if (version_compare($GLOBALS['wp_version'], '4.2', '<')) {
         $this->asset_manager->enqueue_script('dismissable');
         $this->asset_manager->enqueue_style('dismissable');
     }
 }
예제 #3
0
 /**
  * Loads the required styles for the config page.
  */
 function config_page_styles()
 {
     wp_enqueue_style('dashboard');
     wp_enqueue_style('thickbox');
     wp_enqueue_style('global');
     wp_enqueue_style('wp-admin');
     $this->asset_manager->enqueue_style('select2');
     $this->asset_manager->enqueue_style('admin-css');
     $this->asset_manager->enqueue_style('kb-search');
 }
 /**
  * Enqueue's stylesheet for the dashboard if the current page is the dashboard
  */
 public function enqueue_dashboard_stylesheet()
 {
     $current_screen = get_current_screen();
     if ($current_screen instanceof WP_Screen && 'dashboard' === $current_screen->id) {
         $asset_manager = new WPSEO_Admin_Asset_Manager();
         $asset_manager->enqueue_style('wp-dashboard');
     }
 }
 /**
  * Enqueues the assets needed for the wizard.
  */
 public function enqueue_assets()
 {
     wp_enqueue_media();
     /*
      * Print the `forms.css` WP stylesheet before any Yoast style, this way
      * it's easier to override selectors with the same specificity later.
      */
     wp_enqueue_style('forms');
     $assetManager = new WPSEO_Admin_Asset_Manager();
     $assetManager->register_assets();
     $assetManager->enqueue_script('configuration-wizard');
     $assetManager->enqueue_style('yoast-components');
     $config = $this->get_config();
     wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'configuration-wizard', 'yoastWizardConfig', $config);
 }
 /**
  * Enqueues all the assets needed for the primary term interface
  *
  * @return void
  */
 public function enqueue_assets()
 {
     global $pagenow;
     if (!WPSEO_Metabox::is_post_edit($pagenow)) {
         return;
     }
     $taxonomies = $this->get_primary_term_taxonomies();
     // Only enqueue if there are taxonomies that need a primary term.
     if (empty($taxonomies)) {
         return;
     }
     $asset_manager = new WPSEO_Admin_Asset_Manager();
     $asset_manager->enqueue_style('primary-category');
     $asset_manager->enqueue_script('primary-category');
     $taxonomies = array_map(array($this, 'map_taxonomies_for_js'), $taxonomies);
     $data = array('taxonomies' => $taxonomies);
     wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'primary-category', 'wpseoPrimaryCategoryL10n', $data);
 }
/**
 * Enqueue CSS to format the Yoast SEO adminbar item.
 */
function wpseo_admin_bar_style()
{
    if (!is_admin_bar_showing()) {
        return;
    }
    $asset_manager = new WPSEO_Admin_Asset_Manager();
    $asset_manager->register_assets();
    $asset_manager->enqueue_style('adminbar');
}
/**
 * Enqueue a tiny bit of CSS to show so the adminbar shows right.
 */
function wpseo_admin_bar_style()
{
    $enqueue_style = false;
    // Single post in the frontend.
    if (!is_admin() && is_admin_bar_showing()) {
        $enqueue_style = is_singular() || is_category();
    }
    // Single post in the backend.
    if (is_admin()) {
        $screen = get_current_screen();
        // Post (every post_type) or category page.
        if ('post' === $screen->base || 'edit-tags' === $screen->base) {
            $enqueue_style = true;
        }
    }
    if ($enqueue_style) {
        $asset_manager = new WPSEO_Admin_Asset_Manager();
        $asset_manager->register_assets();
        $asset_manager->enqueue_style('adminbar');
    }
}
예제 #9
0
 /**
  * Load the admin redirects scripts
  */
 public function page_scripts()
 {
     $asset_manager = new WPSEO_Admin_Asset_Manager();
     $asset_manager->enqueue_script('admin-gsc');
     $asset_manager->enqueue_style('metabox-css');
     add_screen_option('per_page', array('label' => __('Crawl errors per page', 'wordpress-seo'), 'default' => 50, 'option' => 'errors_per_page'));
 }
예제 #10
0
 /**
  * Enqueues the (tiny) global stylesheet needed for the plugin.
  */
 public function enqueue_global_style()
 {
     $asset_manager = new WPSEO_Admin_Asset_Manager();
     $asset_manager->enqueue_style('admin-global');
 }
예제 #11
0
 /**
  * Enqueue our styling for dismissible yoast notifications.
  */
 public function enqueue_dismissible()
 {
     $this->asset_manager->enqueue_style('dismissible');
 }
예제 #12
0
 /**
  * Enqueues all the needed JS and CSS.
  *
  * @todo [JRF => whomever] create css/metabox-mp6.css file and add it to the below allowed colors array when done
  */
 public function enqueue()
 {
     global $pagenow;
     $asset_manager = new WPSEO_Admin_Asset_Manager();
     $is_editor = self::is_post_overview($pagenow) || self::is_post_edit($pagenow);
     /* Filter 'wpseo_always_register_metaboxes_on_admin' documented in wpseo-main.php */
     if (!$is_editor && apply_filters('wpseo_always_register_metaboxes_on_admin', false) === false || $this->is_metabox_hidden() === true) {
         return;
     }
     if (self::is_post_overview($pagenow)) {
         $asset_manager->enqueue_style('edit-page');
     } else {
         if (0 != get_queried_object_id()) {
             wp_enqueue_media(array('post' => get_queried_object_id()));
             // Enqueue files needed for upload functionality.
         }
         $asset_manager->enqueue_style('metabox-css');
         $asset_manager->enqueue_style('scoring');
         $asset_manager->enqueue_style('snippet');
         $asset_manager->enqueue_style('select2');
         $asset_manager->enqueue_style('kb-search');
         $asset_manager->enqueue_script('metabox');
         $asset_manager->enqueue_script('admin-media');
         $asset_manager->enqueue_script('post-scraper');
         $asset_manager->enqueue_script('replacevar-plugin');
         $asset_manager->enqueue_script('shortcode-plugin');
         wp_enqueue_script('jquery-ui-autocomplete');
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', $this->localize_media_script());
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'post-scraper', 'wpseoPostScraperL10n', $this->localize_post_scraper_script());
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'replacevar-plugin', 'wpseoReplaceVarsL10n', $this->localize_replace_vars_script());
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'shortcode-plugin', 'wpseoShortcodePluginL10n', $this->localize_shortcode_plugin_script());
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoAdminL10n', WPSEO_Help_Center::get_translated_texts());
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoSelect2Locale', WPSEO_Utils::get_language(get_locale()));
         if (post_type_supports(get_post_type(), 'thumbnail')) {
             $asset_manager->enqueue_style('featured-image');
             $asset_manager->enqueue_script('featured-image');
             $featured_image_l10 = array('featured_image_notice' => __('The featured image should be at least 200x200 pixels to be picked up by Facebook and other social media sites.', 'wordpress-seo'));
             wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoFeaturedImageL10n', $featured_image_l10);
         }
     }
 }
예제 #13
0
 /**
  * Enqueue assets
  */
 public function enqueue_assets()
 {
     $asset_manager = new WPSEO_Admin_Asset_Manager();
     $asset_manager->enqueue_style('alerts');
 }