本文整理汇总了PHP中WP_Styles::add方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Styles::add方法的具体用法?PHP WP_Styles::add怎么用?PHP WP_Styles::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Styles
的用法示例。
在下文中一共展示了WP_Styles::add方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* @param WP_Styles $wp_styles
* @action wp_default_styles
*/
function register_styles($wp_styles)
{
$handle = 'customize-partial-refresh-widgets-preview';
$src = $this->get_dir_url('css/customize-partial-refresh-widgets-preview.css');
$deps = array();
$wp_styles->add($handle, $src, $deps, $this->get_version());
$this->style_handles['widgets-preview'] = $handle;
}
开发者ID:AshiqKiron,项目名称:wp-customize-partial-refresh,代码行数:12,代码来源:class-wp-customize-partial-refresh-plugin.php
示例2: wp_enqueue_style
function wp_enqueue_style($handle, $src = false, $deps = array(), $ver = false, $media = false)
{
global $wp_styles;
if (!is_a($wp_styles, 'WP_Styles')) {
$wp_styles = new WP_Styles();
}
if ($src) {
$_handle = explode('?', $handle);
$wp_styles->add($_handle[0], $src, $deps, $ver, $media);
}
$wp_styles->enqueue($handle);
}
示例3: wp_default_styles
/**
* Assign default styles to $styles object.
*
* Nothing is returned, because the $styles parameter is passed by reference.
* Meaning that whatever object is passed will be updated without having to
* reassign the variable that was passed back to the same value. This saves
* memory.
*
* Adding default styles is not the only task, it also assigns the base_url
* property, the default version, and text direction for the object.
*
* @since 2.6.0
*
* @param WP_Styles $styles
*/
function wp_default_styles(&$styles)
{
include ABSPATH . WPINC . '/version.php';
// include an unmodified $wp_version
if (!defined('SCRIPT_DEBUG')) {
define('SCRIPT_DEBUG', false !== strpos($wp_version, '-src'));
}
if (!($guessurl = site_url())) {
$guessurl = wp_guess_url();
}
$styles->base_url = $guessurl;
$styles->content_url = defined('WP_CONTENT_URL') ? WP_CONTENT_URL : '';
$styles->default_version = get_bloginfo('version');
$styles->text_direction = function_exists('is_rtl') && is_rtl() ? 'rtl' : 'ltr';
$styles->default_dirs = array('/wp-admin/', '/wp-includes/css/');
$open_sans_font_url = '';
/* translators: If there are characters in your language that are not supported
* by Open Sans, translate this to 'off'. Do not translate into your own language.
*/
if ('off' !== _x('on', 'Open Sans font: on or off')) {
$subsets = 'latin,latin-ext';
/* translators: To add an additional Open Sans character subset specific to your language,
* translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language.
*/
$subset = _x('no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)');
if ('cyrillic' == $subset) {
$subsets .= ',cyrillic,cyrillic-ext';
} elseif ('greek' == $subset) {
$subsets .= ',greek,greek-ext';
} elseif ('vietnamese' == $subset) {
$subsets .= ',vietnamese';
}
// Hotlink Open Sans, for now
$open_sans_font_url = "https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset={$subsets}";
}
// Register a stylesheet for the selected admin color scheme.
$styles->add('colors', true, array('wp-admin', 'buttons', 'open-sans', 'dashicons'));
$suffix = SCRIPT_DEBUG ? '' : '.min';
// Admin CSS
$styles->add('wp-admin', "/wp-admin/css/wp-admin{$suffix}.css", array('open-sans', 'dashicons'));
$styles->add('login', "/wp-admin/css/login{$suffix}.css", array('buttons', 'open-sans', 'dashicons'));
$styles->add('install', "/wp-admin/css/install{$suffix}.css", array('buttons', 'open-sans'));
$styles->add('wp-color-picker', "/wp-admin/css/color-picker{$suffix}.css");
$styles->add('customize-controls', "/wp-admin/css/customize-controls{$suffix}.css", array('wp-admin', 'colors', 'ie', 'imgareaselect'));
$styles->add('customize-widgets', "/wp-admin/css/customize-widgets{$suffix}.css", array('wp-admin', 'colors'));
$styles->add('customize-nav-menus', "/wp-admin/css/customize-nav-menus{$suffix}.css", array('wp-admin', 'colors'));
$styles->add('press-this', "/wp-admin/css/press-this{$suffix}.css", array('open-sans', 'buttons'));
$styles->add('ie', "/wp-admin/css/ie{$suffix}.css");
$styles->add_data('ie', 'conditional', 'lte IE 7');
// Common dependencies
$styles->add('buttons', "/wp-includes/css/buttons{$suffix}.css");
$styles->add('dashicons', "/wp-includes/css/dashicons{$suffix}.css");
$styles->add('open-sans', $open_sans_font_url);
// Includes CSS
$styles->add('admin-bar', "/wp-includes/css/admin-bar{$suffix}.css", array('open-sans', 'dashicons'));
$styles->add('wp-auth-check', "/wp-includes/css/wp-auth-check{$suffix}.css", array('dashicons'));
$styles->add('editor-buttons', "/wp-includes/css/editor{$suffix}.css", array('dashicons'));
$styles->add('media-views', "/wp-includes/css/media-views{$suffix}.css", array('buttons', 'dashicons', 'wp-mediaelement'));
$styles->add('wp-pointer', "/wp-includes/css/wp-pointer{$suffix}.css", array('dashicons'));
$styles->add('customize-preview', "/wp-includes/css/customize-preview{$suffix}.css");
// External libraries and friends
$styles->add('imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8');
$styles->add('wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog{$suffix}.css", array('dashicons'));
$styles->add('mediaelement', "/wp-includes/js/mediaelement/mediaelementplayer.min.css", array(), '2.17.0');
$styles->add('wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement.css", array('mediaelement'));
$styles->add('thickbox', '/wp-includes/js/thickbox/thickbox.css', array('dashicons'));
// Deprecated CSS
$styles->add('media', "/wp-admin/css/deprecated-media{$suffix}.css");
$styles->add('farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.3u1');
$styles->add('jcrop', "/wp-includes/js/jcrop/jquery.Jcrop.min.css", array(), '0.9.12');
$styles->add('colors-fresh', false, array('wp-admin', 'buttons'));
// Old handle.
// RTL CSS
$rtl_styles = array('wp-admin', 'install', 'wp-color-picker', 'customize-controls', 'customize-widgets', 'customize-nav-menus', 'ie', 'login', 'press-this', 'buttons', 'admin-bar', 'wp-auth-check', 'editor-buttons', 'media-views', 'wp-pointer', 'wp-jquery-ui-dialog', 'media', 'farbtastic');
foreach ($rtl_styles as $rtl_style) {
$styles->add_data($rtl_style, 'rtl', 'replace');
if ($suffix) {
$styles->add_data($rtl_style, 'suffix', $suffix);
}
}
}
示例4: sp_plugin_enqueue_style
function sp_plugin_enqueue_style($handle, $src, $deps = array(), $ver = false)
{
global $sp_plugin_styles;
if (empty($src)) {
return;
}
if (!is_a($sp_plugin_styles, 'WP_Styles')) {
$sp_plugin_styles = new WP_Styles();
}
if ($src) {
$_handle = explode('?', $handle);
global $spDevice;
$media = 'all';
if ($spDevice == 'mobile') {
$media = 'mobile';
}
if ($spDevice == 'tablet') {
$media = 'tablet';
}
$sp_plugin_styles->add($_handle[0], $src, $deps, $ver, $media);
}
$sp_plugin_styles->enqueue($handle);
}
示例5: wp_enqueue_style
/**
* Enqueue a CSS stylesheet.
*
* Registers the style if source provided (does NOT overwrite) and enqueues.
*
* @see WP_Dependencies::add(), WP_Dependencies::enqueue()
* @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
* @global WP_Styles $wp_styles The WP_Styles object for printing styles.
*
* @since 2.6.0
*
* @param string $handle Name of the stylesheet.
* @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'.
* @param array $deps An array of registered style handles this stylesheet depends on. Default empty array.
* @param string|bool $ver String specifying the stylesheet version number, if it has one. This parameter is used
* to ensure that the correct version is sent to the client regardless of caching, and so
* should be included if a version number is available and makes sense for the stylesheet.
* @param string $media Optional. The media for which this stylesheet has been defined.
* Default 'all'. Accepts 'all', 'aural', 'braille', 'handheld', 'projection', 'print',
* 'screen', 'tty', or 'tv'.
*/
function wp_enqueue_style($handle, $src = false, $deps = array(), $ver = false, $media = 'all')
{
global $wp_styles;
if (!is_a($wp_styles, 'WP_Styles')) {
if (!did_action('init')) {
_doing_it_wrong(__FUNCTION__, sprintf(__('Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.'), '<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>'), '3.3');
}
$wp_styles = new WP_Styles();
}
if ($src) {
$_handle = explode('?', $handle);
$wp_styles->add($_handle[0], $src, $deps, $ver, $media);
}
$wp_styles->enqueue($handle);
}
示例6: register_styles
/**
* Register styles.
*
* @action wp_default_styles, 11
*
* @param \WP_Styles $wp_styles Instance of \WP_Styles.
*/
public function register_styles(\WP_Styles $wp_styles)
{
$min = SCRIPT_DEBUG ? '' : '.min';
$handle = 'customize-snapshots';
$src = $this->dir_url . 'css/customize-snapshots' . $min . '.css';
$deps = array('wp-jquery-ui-dialog');
$wp_styles->add($handle, $src, $deps);
$handle = 'customize-snapshots-preview';
$src = $this->dir_url . 'css/customize-snapshots-preview' . $min . '.css';
$deps = array('customize-preview');
$wp_styles->add($handle, $src, $deps);
}
示例7: register_styles
/**
* Register styles.
*
* @param \WP_Styles $wp_styles Instance of \WP_Styles.
* @action wp_default_styles
*/
public function register_styles(\WP_Styles $wp_styles)
{
$handle = 'customize-rest-resources-pane';
$src = $this->dir_url . 'css/customize-pane.css';
$deps = array('customize-controls');
$wp_styles->add($handle, $src, $deps, $this->version);
}
示例8:
/**
* Register styles.
*
* @param \WP_Styles $wp_styles
* @action wp_default_styles
*/
function register_styles(\WP_Styles $wp_styles)
{
$slug = 'customize-widgets';
$handle = "{$this->slug}-{$slug}";
$src = $this->dir_url . 'css/customize-widgets.css';
$wp_styles->add($handle, $src);
$this->style_handles[$slug] = $handle;
$handle = "{$this->slug}-post-edit";
$src = $this->dir_url . 'css/post-edit.css';
$wp_styles->add($handle, $src);
$this->style_handles['post_edit'] = $handle;
}
示例9: gp_styles_default
/**
* Register the GlotPress styles
*
* @param WP_Styles $styles
*/
function gp_styles_default(&$styles)
{
$url = gp_plugin_url('assets/css');
$styles->add('base', $url . '/style.css', array(), '20150717');
}
示例10: array
/**
* Register styles.
*
* @param \WP_Styles $wp_styles Instance of \WP_Styles.
* @action wp_default_styles
*/
function register_styles(\WP_Styles $wp_styles)
{
$src = $this->dir_url . 'css/customize-concurrency.css';
$deps = array('customize-controls');
$wp_styles->add($this->slug, $src, $deps);
}