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
查看更多 >