You appear to be a bot. Output may be restricted
Description
Generate CSS.
Usage
$string = twenty_twenty_one_generate_css( $selector, $style, $value, $prefix, $suffix, $display );
Parameters
- $selector
- ( string ) required – The CSS selector.
- $style
- ( string ) required – The CSS style.
- $value
- ( string ) required – The CSS value.
- $prefix
- ( string ) optional – The CSS prefix.
- $suffix
- ( string ) optional – The CSS suffix.
- $display
- ( bool ) optional default: 1 – Print the styles.
Returns
string
Source
File name: twentytwentyone/inc/custom-css.php
Lines:
1 to 21 of 21
function twenty_twenty_one_generate_css( $selector, $style, $value, $prefix = '', $suffix = '', $display = true ) { // Bail early if there is no $selector elements or properties and $value. if ( ! $value || ! $selector ) { return ''; } $css = sprintf( '%s { %s: %s; }', $selector, $style, $prefix . $value . $suffix ); if ( $display ) { /* * Note to reviewers: $css contains auto-generated CSS. * It is included inside <style> tags and can only be interpreted as CSS on the browser. * Using wp_strip_all_tags() here is sufficient escaping to avoid * malicious attempts to close </style> and open a <script>. */ echo wp_strip_all_tags( $css ); // phpcs:ignore WordPress.Security.EscapeOutput } return $css; }