WordPress自定义古腾堡编辑器的颜色调色板

* change_gutenberg_color_palette. * * Add theme support…

* change_gutenberg_color_palette.

*

* Add theme support for editor-color-palette,

* and set colours for the gutenberg colour pallete.

*

* @see https://since1979.dev/wp-snippet-002-changing-the-gutenberg-color-palette/

*

* @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

*

* @return void

*/

* 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/

*/ #323232

#323232 #eeeeee

#eeeeee* disable_custom_color_picler.

*

* Disable the custom color selector of the gutenberg color palette,

*

* @see https://since1979.dev/wp-snippet-002-changing-the-gutenberg-color-palette/

*

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

*/ * 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_custom_color_picker’

)

;

使用上面的代码,我们向

after_setup_theme

钩子添加了另一个操作,并注册了一个名为

disable_custom_color_picker

的回调函数。

disable_custom_color_picker

函数内部,我们再次使用

add_theme_support

函数,但这一次我们添加了对

disable-custom-colors

的支持

如下图所示,这会从面板上删除“自定义颜色”链接。

类别:WordPress教程

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

评论 (0)COMMENT