wp_get_duotone_filter_property

函式
wp_get_duotone_filter_property ( $preset )
Access
Private
引數
  • (array) $preset Duotone preset value as seen in theme.json.
    Required:
返回值
  • (string) Duotone CSS filter property url value.
定義位置
相關方法
wp_get_duotone_filter_idwp_get_duotone_filter_svgwp_render_duotone_filter_presetwp_get_theme_errorwp_get_pomo_file_data
引入
5.9.0
棄用
-

wp_get_duotone_filter_property: 這個函式返回用於對圖片進行雙色過濾的CSS屬性。它通常用於為前端的影象設定樣式。

返回CSS過濾器屬性的網址,以引用渲染的SVG。

function wp_get_duotone_filter_property( $preset ) {
	if ( isset( $preset['colors'] ) && 'unset' === $preset['colors'] ) {
		return 'none';
	}
	$filter_id = wp_get_duotone_filter_id( $preset );
	return "url('#" . $filter_id . "')";
}

常見問題

FAQs
檢視更多 >