WordPress 新的区块(Gutenberg)编辑器,已推出一年有余,好用与否,只能见仁见智了。从Gutenberg插件只有2颗星的评分可以看出,大部分人还是无法适应,其中也包括我。文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
对于折腾多年WordPress的用户,上手新编辑器没什么难度,区块编辑器还是有很多优点的,例如,区块编辑器可以将一个添加到文章中并编辑好的区块,添加保存到可重用区块中,下次使用时直接点一下就可以插入文章中,非常方便。再如,区块编辑器可以利用WP已集成的前端样式和script,在文章中编排出比较复杂的响应式布局等。
如果文章是用经典编辑器写的,当转到区块编辑器中编辑,在编辑框上面会提示“经典”字样,点开会直接在区块编辑器中显示经典编辑器的工具栏,还可以点击添加区块在“格式”中找到“经典”区块并插入到文章中,同样可使用之前的经典编辑器,混合双打,如下图,也可以将之前的文章转换为区块等。文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
优势说完,再说说劣势,从WP升级后的宣传文字:文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
从WordPress 5.0开始带来的区块编辑器,为您带来全新的区块、更直觉的交互和改良的无障碍访问。新功能提升了编辑器的设计自由度,为您带来更多布局选项和样式变化,让设计师能够全面控制网站的外观。这次发布也为您带来了二〇二〇主题,给用户带来更多的设计弹性,并与区块编辑器完美整合。现在要建立美观的网页及高级页面布局,是再也简单不过的事了。文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
可以看出,这个编辑器是给网页设计师准备的,而大部分网站编辑人员只是简单的敲些文字,顶多再加个图片而已,不是什么设计师,所以你的网站如有文字录入人员,让一个非专业人员学习新的东西,可不是一件简单的事,与之类似的编辑器从未在其它网站程序上应用过,其“先进的理念”(其实N年前就有类似的可视化插件了),会让刚接触WP的用户一头雾水,这也是一些人极力反对的原因,因为很多主题设计者认为改变原有的使用习惯会让用户难以接受。文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
既然WP开发者力排众议强推新编辑器,做为一个主题开发者,还是要与时俱进,近期开始研究将之前主题的短代码转换为区块并集成到区块编辑器中,新的区块需要大量的JS控制才能实现,原来短代码简单几行代码实现的功能,改成区块代码量成倍增加,对于像我这种折腾WP近10年的老鸟,也需要看官网教程一步步的学习,上手难度不小。文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
个人认为WP程序开发方向有些迷失,可能开发者除了修补漏洞,也不知道再升级什么了,弄个新编辑器给大家一个“惊喜“ ,我还是认为这个区块编辑器以插件形式存在更好,因为这玩意本来就是别人开发的插件,集成在程序中而已。文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
上面只是个人对新编辑器的看法,本文记录一下在WordPress 区块(Gutenberg)编辑器中只显示自己需要的区块。文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
默认新编辑器区块众多,让人眼花撩乱,大部分可能都用不到,可以在编辑页面点右上角三个小点,工具 → 区块管理器中,取消某个分类的区块或者单独取消某个区块显示,还可以通过下面的代码,直接屏蔽掉不想显示的区块。文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
将下面的代码添加到当前主题函数模板functions.php中:文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
add_filter( 'allowed_block_types', 'zm_allowed_block_types', 10, 2 ); function zm_allowed_block_types( $allowed_blocks, $post ) { $allowed_blocks = array( 'core/image', 'core/paragraph', 'core/heading', 'core/list', ); // 在页面编辑中单独显示的区块 if( $post->post_type === 'page' ) { $allowed_blocks[] = 'core/shortcode'; } return $allowed_blocks; }
把想显示的区块名称添加进去即可。文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
更多的区块名称:文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/shortcode文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/image文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/gallery文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/heading文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/quote文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/embed文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/list文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/separator文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/more文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/button文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/pullquote文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/table文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/preformatted文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/code文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/html文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/freeform文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/latest-posts文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/categories文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/cover (previouslycore/cover-image)文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/text-columns文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/verse文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/video文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/audio文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/block文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core/paragraph文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/twitter文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/youtube文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/facebook文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/instagram文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/wordpress文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/soundcloud文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/spotify文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/flickr文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/vimeo文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/animoto文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/cloudup文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/collegehumor文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/dailymotion文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/funnyordie文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/hulu文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/imgur文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/issuu文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/kickstarter文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/meetup-com文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/mixcloud文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/photobucket文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/polldaddy文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/reddit文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/reverbnation文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/screencast文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/scribd文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/slideshare文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/smugmug文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/speaker文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/ted文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/tumblr文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/videopress文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
core-embed/wordpress-tv文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html
文章源自知更鸟-https://zmingcx.com/wordpress-gutenberg-editor-whitelist.html

2019年12月17日 11点44分 1F
鸟叔开始研究古腾堡编辑器了,妥妥的,
2019年12月17日 20点25分 2F
古腾堡确实很难用啊,不伦不类的
2019年12月19日 09点45分 3F
就发个简单图文,給我整个这么复杂的编辑器,做个这么复杂的操作,WP开发作者有坑
2019年12月19日 10点39分 4F
古腾堡用习惯了,你会喜欢上这个编辑器,任何事物都是发展的,只是你们还不适应罢了,并不是编辑器的问题。
2019年12月19日 17点39分 5F
希望下个版本手动缩略图能支持WooCommerce产品中
2019年12月20日 16点23分 6F
鸟哥,加油!
2019年12月23日 12点24分 7F
时代在进步,不能盲目退缩。
2020年7月12日 09点07分 8F
有个小问题知更鸟不支持古腾堡吗?
2020年7月13日 18点47分 中国 B1
@ 小艾 所有主题都支持