wp_render_duotone_support()
云策文档标注
概述
wp_render_duotone_support() 是一个已弃用的 WordPress 函数,用于渲染双色调样式表和 SVG。它已被 WP_Duotone::render_duotone_support() 替代。
关键要点
- 函数 wp_render_duotone_support() 在 WordPress 6.3.0 版本中被弃用,建议使用 WP_Duotone::render_duotone_support() 替代。
- 该函数接受两个参数:$block_content(字符串,必需,渲染的块内容)和 $block(数组,必需,块对象)。
- 返回值为过滤后的块内容字符串。
- 函数内部调用 _deprecated_function() 标记弃用,并转发到 WP_Duotone::render_duotone_support() 处理。
代码示例
function wp_render_duotone_support( $block_content, $block ) {
_deprecated_function( __FUNCTION__, '6.3.0', 'WP_Duotone::render_duotone_support()' );
$wp_block = new WP_Block( $block );
return WP_Duotone::render_duotone_support( $block_content, $block, $wp_block );
}注意事项
- 自 WordPress 6.3.0 起,应避免使用此函数,改用 WP_Duotone::render_duotone_support() 以确保兼容性。
- 函数在 5.8.0 版本引入,6.1.0 版本允许取消预设颜色设置。
原文内容
Renders out the duotone stylesheet and SVG.
Parameters
$block_contentstringrequired-
Rendered block content.
$blockarrayrequired-
Block object.
Source
function wp_render_duotone_support( $block_content, $block ) {
_deprecated_function( __FUNCTION__, '6.3.0', 'WP_Duotone::render_duotone_support()' );
$wp_block = new WP_Block( $block );
return WP_Duotone::render_duotone_support( $block_content, $block, $wp_block );
}
Changelog
| Version | Description |
|---|---|
| 6.3.0 | Deprecated. Use WP_Duotone::render_duotone_support() instead. |
| 6.1.0 | Allow unset for preset colors. |
| 5.8.0 | Introduced. |