wp_global_styles_render_svg_filters

函式
wp_global_styles_render_svg_filters ( No parameters )

wp_global_styles_render_svg_filters: 這個函式用於渲染全域性樣式的SVG過濾器。它接收一個全域性樣式的陣列作為引數,並返回渲染了SVG過濾器的過濾後的樣式。

渲染由theme.json提供的SVG過濾器。

注意,這不會渲染由wp_render_duotone_support處理的每塊使用者定義的過濾器,但它應該在主體中的過濾器內容之前渲染,以滿足Safari的渲染怪癖。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_global_styles_render_svg_filters() {
/*
* When calling via the in_admin_header action, we only want to render the
* SVGs on block editor pages.
*/
if (
is_admin() &&
! get_current_screen()->is_block_editor()
) {
return;
}
$filters = wp_get_global_styles_svg_filters();
if ( ! empty( $filters ) ) {
echo $filters;
}
}
function wp_global_styles_render_svg_filters() { /* * When calling via the in_admin_header action, we only want to render the * SVGs on block editor pages. */ if ( is_admin() && ! get_current_screen()->is_block_editor() ) { return; } $filters = wp_get_global_styles_svg_filters(); if ( ! empty( $filters ) ) { echo $filters; } }
function wp_global_styles_render_svg_filters() {
	/*
	 * When calling via the in_admin_header action, we only want to render the
	 * SVGs on block editor pages.
	 */
	if (
		is_admin() &&
		! get_current_screen()->is_block_editor()
	) {
		return;
	}

	$filters = wp_get_global_styles_svg_filters();
	if ( ! empty( $filters ) ) {
		echo $filters;
	}
}

常見問題

FAQs
檢視更多 >