wp_custom_css_cb

函式
wp_custom_css_cb ( No parameters )

wp_custom_css_cb: 這是一個過濾鉤,允許你修改WordPress定製器中的自定義CSS程式碼。自定義CSS程式碼通常用於在你的WordPress網站上應用自定義樣式。

渲染自定義CSS樣式元素。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_custom_css_cb() {
$styles = wp_get_custom_css();
if ( $styles || is_customize_preview() ) :
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
?>
<style<?php echo $type_attr; ?> id="wp-custom-css">
<?php
// Note that esc_html() cannot be used because `div &gt; span` is not interpreted properly.
echo strip_tags( $styles );
?>
</style>
<?php
endif;
}
function wp_custom_css_cb() { $styles = wp_get_custom_css(); if ( $styles || is_customize_preview() ) : $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; ?> <style<?php echo $type_attr; ?> id="wp-custom-css"> <?php // Note that esc_html() cannot be used because `div &gt; span` is not interpreted properly. echo strip_tags( $styles ); ?> </style> <?php endif; }
function wp_custom_css_cb() {
	$styles = wp_get_custom_css();
	if ( $styles || is_customize_preview() ) :
		$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
		?>
		<style<?php echo $type_attr; ?> id="wp-custom-css">
			<?php
			// Note that esc_html() cannot be used because `div &gt; span` is not interpreted properly.
			echo strip_tags( $styles );
			?>
		</style>
		<?php
	endif;
}

常見問題

FAQs
檢視更多 >