WordPress自定义古腾堡编辑器的渐变色

在《* theme_custom_gradients. * * Add custom gradients to…

在《* theme_custom_gradients.

*

* Add custom gradients to the Gutenberg editor.

*

* @see https://since1979.dev/snippet-011-custom-gutenberg-gradient-colors/

*

* @uses add_theme_support() https://developer.wordpress.org/reference/functions/add_theme_support/

* @uses __() https://developer.wordpress.org/reference/functions/__/

* @uses array() https://www.php.net/manual/en/function.array.php

*/ * Hook: after_setup_theme.

*

* @uses add_action() https://developer.wordpress.org/reference/functions/add_action/

* @uses after_setup_theme https://developer.wordpress.org/reference/hooks/after_setup_theme/

*/ 0%100% 0%100% 0%100% 0%100% 0%100% 0%100%* disable_editor_gradients.

*

* Disable gradient coors in the gutenberg editor.

*

* @see https://since1979.dev/snippet-011-custom-gutenberg-gradient-colors/

*

* @uses add_theme_support() https://developer.wordpress.org/reference/functions/add_theme_support/

* @uses array() https://www.php.net/manual/en/function.array.php

*/ * Hook: after_setup_theme.

*

* @uses add_action() https://developer.wordpress.org/reference/functions/add_action/

* @uses after_setup_theme https://developer.wordpress.org/reference/hooks/after_setup_theme/

*/

‘disable_editor_gradients’

)

;

?>

使用上面的代码,我们将一个操作添加到

after_setup_theme

钩子中,并注册一个名为

disable_editor_gradients

的回调函数。

disable_editor_gradients

函数内部,我们使用

add_theme_support

函数添加对

disable-custom-gradients

的支持

。然后,我们还为

editor-gradient-presets

主题支持设置了一个空数组,以删除默认渐变。

类别:WordPress教程

本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

评论 (0)COMMENT