当前位置: 首页>>代码示例>>PHP>>正文


PHP WP_Styles::enqueue方法代码示例

本文整理汇总了PHP中WP_Styles::enqueue方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Styles::enqueue方法的具体用法?PHP WP_Styles::enqueue怎么用?PHP WP_Styles::enqueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Styles的用法示例。


在下文中一共展示了WP_Styles::enqueue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
}
开发者ID:nurpax,项目名称:saastafi,代码行数:12,代码来源:functions.wp-styles.php

示例2: 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);
}
开发者ID:bself,项目名称:nuimage-wp,代码行数:23,代码来源:sp-api-plugins.php

示例3: 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);
}
开发者ID:luskyj89,项目名称:mt-wordpress,代码行数:36,代码来源:functions.wp-styles.php


注:本文中的WP_Styles::enqueue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。