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