wordpress函数wp_register_style()

wp_register_style( string $handle, string|bool $src, string[] $deps = array(), string|bool|null $ver = false, string $media = ‘all’ )

注册CSS样式表。
Register a CSS stylesheet.


另请参见#另请参阅WP_Dependencies::add()


参数 类型 说明
$handle (string) 样式表的名称。应该是独一无二的。
$src (string | bool) 样式表的完整URL,或样式表相对于WordPress根目录的路径。如果source设置为false,则样式表是它所依赖的其他样式表的别名。
$deps (string[]) 注册样式表的数组处理此样式表依赖的。
$ver (string | bool | null) 指定样式表版本号(如果有)的字符串,将其作为查询字符串添加到URL中,以用于缓存破坏。如果version设置为false,则会自动添加与当前安装的WordPress版本相同的版本号。如果设置为null,则不添加任何版本。
$media (string) 为其定义了此样式表的媒体。接受“全部”、“打印”和“屏幕”等媒体类型,或接受诸如“(方向:纵向)”和“(最大宽度:640px)”等媒体查询。

**
 * Register a CSS stylesheet.
 *
 * @see WP_Dependencies::add()
 * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
 *
 * @since 2.6.0
 * @since 4.3.0 A return value was added.
 *
 * @param string      $handle Name of the stylesheet.
 * @param string|bool $src    Path to the stylesheet from the WordPress root directory. 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. Used to ensure that the correct version
 *                            is sent to the client regardless of caching. Default 'false'. Accepts 'false', 'null', or 'string'.
 * @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'.
 * @return bool Whether the style has been registered. True on success, false on failure.
 */
function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
    _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
 
    return wp_styles()->add( $handle, $src, $deps, $ver, $media );
}

 

更新版本 源码位置 使用 被使用
4.3.0 wp-includes/functions.wp-styles.php 16 18

 

版权声明:原创作品,未经允许不得转载,否则将追究法律责任。
本站资源有的自互联网收集整理,如果侵犯了您的合法权益,请联系本站我们会及时删除。
本站资源仅供研究、学习交流之用,若使用商业用途,请购买正版授权,否则产生的一切后果将由下载用户自行承担。
本文链接:子佩工作室https://zptheme.com/5488.html
许可协议:《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权

本站分为普通会员,SVIP会员,永久会员。
SVIP会员新用户注册即送180天,到期后可邀请好友2位/180天进行无限续期。
永久会员支持微信支付在线开通。

积分是本站通用虚拟货币,可用于文章资源购买。
每天签到,评论或点赞文章,或者投稿都可免费获得积分
新用户注册免费赠送2积分 邀请用户注册2位/2积分

如果您已经成功付款但是网站没有弹出成功提示,请联系售后提供付款信息为您处理

本站资源属于虚拟商品,具有可复制性,可传播性,一旦授予,不接受任何形式的退款、换货要求。请您在购买获取之前确认好 是您所需要的资源

需要效果图的,可以联系售后(右侧核保售后,扫码添加或者点击 加入我们-联系客服)。或者微信添加企业微信:子佩工作室

计划书请提供费率条款(现价分红),100起。WP主题一般单个问题30起。主题二开500起,开发新主题3000起。低于1000须全款,其余先支付全款的60%,完成后支付余下的。

资源是指寿险计划书(定制除外),WP主题或插件不包含在永久会员之内!

发表回复