wp_add_inline_style()添加一个style.css文件

目录

描述

Adds extra CSS.

Works only if the stylesheet has already been added. Accepts a string $data containing the CSS. If two or more CSS code blocks are added to the same stylesheet $handle, they will be printed in the order they were added, i.e. the latter added styles can redeclare the previous.

wp_add_inline_style() 描述

用法

<?php wp_add_inline_style$handle$data ); ?>

wp_add_inline_style() 用法

参数

$handle

(string) (必填) Name of the script to which to add the extra styles. Lowercase string.

默认值: None

$data

(string) (必填) String containing the CSS to be added.

默认值: None

wp_add_inline_style() 参数

示例

wp_add_inline_style allows you to print extra styling whenever a certain stylesheet is loaded. For instance suppose a plug-in or theme makes use of the class .mycolor in a stylesheet to set a background color. This can be over-ridden by a user chosen color, stored in the database by using wp_add_inline_style to print the extra styling.

wp_add_inline_style() 示例

历史

添加于 版本: 3.3

wp_add_inline_style() 历史

源文件

wp_add_inline_style() 函数的代码位于 wp-includes/functions.wp-styles.php

wp_add_inline_style() 源文件