如果您使用WordPress 5.0 及更高版本,除非您一直生活在岩石之下,否则您无疑会听说过2018 年 12 月(December 2018)合并到WordPress的(WordPress)Gutenberg更新。
因此,如果您使用的是最新版本的 WP,您要么已经在使用Gutenberg ,要么通过安装WordPress 经典编辑器插件( WordPress Classic Editor plugin)继续使用经典编辑器。
为什么选择古腾堡?(Why Gutenberg?)
许多 WP 用户还没有准备好跳上古腾堡旅行车(on the Gutenberg wagon),但有些人准备好了,包括这个网站。
您可能想要使用古腾堡(Gutenberg)的一些原因是因为它:
- 是 WP 开发者的未来。
- 提供更好的用户体验。
- 比 WP 的原始编辑器 ( TinyMCE ) 更灵活。
- 将为开发商提供一个新的市场。
WordPress 和古腾堡有什么区别?(What Are The Differences Between WordPress & Gutenberg?)
WP 的Classic Editor是一个文本编辑器,看起来很像Microsoft Word。它有一个编辑字段,如下面的屏幕截图所示。
Gutenberg是一个基于块的编辑器,如下所示:
不同类型的内容有多个块,包括它们自己的格式选项。块,例如:
- 按钮
- 图片
- 桌子
- 嵌入
- 列表
- 画廊
- 声音的
- 引号
- 标题
- 代码
- 诗
- 自定义 HTML
此外,主题和插件提供更多块和小部件供您在 WP 帖子和页面中使用。
现有页面或帖子如何受到影响?(How Are Existing Pages Or Posts Affected?)
升级和使用Gutenberg后,您现有的页面和帖子应该会继续正确显示。
但是,您应该检查您的简码并确保您可能正在使用的插件正在运行。
当您编辑现有页面或帖子时,它将自动在一个新的古腾堡(Gutenberg)编辑器经典块中打开。
您准备好进行切换了吗?
使用暂存站点(Use a Staging Site)
您要做的最后一件事是破坏现有网站。避免这种情况的方法是在临时站点上激活(a staging site)Gutenberg。这是您网站的精确复制品,您可以在其中进行测试,而不会对您的实时网站造成任何损害。
测试站点包括您的主题、插件、选项和内容。您的托管公司可能会提供临时站点。如果没有,您可以使用WordPress Staging 插件( WordPress Staging plugin)。
在您的登台站点启动并运行后,安装并激活Gutenberg 插件( Gutenberg plugin)并开始测试。或者在您的计算机上安装一个全新的 WordPress 实例并在那里进行测试。
检查你的插件(Check Your Plugins)
WordPress 用户熟悉当插件不能很好地协同工作时会发生什么。有时是由于功能或代码冲突。这是查看您是否正在使用已安装的所有插件的绝佳时机。如果不是,请删除它们。
您还想查看在WordPress中编辑内容时正在使用哪些插件。Akismet、Contact Form 7、Google Sitemap Generator、WP Super Cache等特定插件与编辑器无关,使用Gutenberg不会受到影响。
另一方面,任何添加功能或改变 WP 经典编辑器外观的插件都可能与Gutenberg不兼容。特别是,生成短代码、添加自定义样式或最近未更新的插件通常会发生冲突并导致问题。
Gutenberg曾经有一个活跃的插件兼容性(Plugin Compatibility)数据库。但是,它已被关闭,因为它不再被积极维护。
您可以查看最终数据并将数据库下载( download the database)为CSV文件。如果无法访问活动的插件兼容性数据库,您将不得不手动测试您使用的每个插件。
尝试在您的测试站点上创建一个新帖子。您将看到您在Gutenberg编辑器中,并且对您来说看起来会有所不同。当您开始键入时,您会自动创建一个段落块。添加新段落时不必添加新块。只需(Just)按回车键或回车键。
由于您正在尝试查看您当前的插件是否可以工作,因此请尝试重新创建您使用每个插件的方式,看看它是否仍然有效。
如果没有,请在默认的Gutenberg块中查找相同的功能,添加该块,然后添加您的内容。
请务必保留无法正常工作的插件列表,以便在使用Gutenberg时将其删除。
如果您需要的功能没有默认块怎么办?(What If There Is No Default Block For The Functionality You Need?)
检查所有块以查看您需要的功能是否存在于另一个块中。如果您找不到可行的方法,您可以联系插件作者并询问他们是否计划更新它以与Gutenberg兼容。
如果一切都失败了,请尝试找到一个可以满足您需求的Gutenberg 插件。( Gutenberg plugin)从您的临时站点中删除不起作用的插件。
上线(Going Live)
在对实时站点进行任何操作之前,请对整个站点进行完整备份,以防在检查兼容性时遗漏某些内容或发生其他错误。
可以在您的测试站点上进行所有必要的更改并将它们推送到您的实时站点。但是,这需要一些技术知识。因此,除非您是开发人员或有适合您的开发人员,否则最好手动进行更改。
首先删除不起作用的插件,然后添加您发现的新插件来替换它们。如果旧插件正在处理现有帖子和页面的数据并且不破坏新插件,您可以保留它们的安装状态。
您想将旧帖子和页面转换为古腾堡块吗?(Do You Want To Convert Your Old Posts & Pages To Gutenberg Blocks?)
打开每个页面并从 Classic Block Menu发布。单击(Click)三个点查看选项(view options)。从下拉菜单中选择Convert to Blocks。
在 WP 将您的内容转换为Gutenberg块系统后,您应该查看每个块。使用块导航(Use Block Navigation)(从图标)查看帖子或页面的所有部分。
正如您在上面的屏幕截图中看到的那样,每个段落、图像、列表和标题现在都在自己的块中。将现有页面和帖子转换为新的Gutenberg系统既快捷又简单。
测试您的插件并找到新插件可能需要几个小时,但您只需执行一次。确保遵循上面建议的步骤,让您轻松无误地迁移到古腾堡。(Gutenberg)
How To Transition From The Classic WordPress Editor To Gutenberg
If уou use WordPress 5.0 and higher, unless you have been living under a rock, you will have undoubtedly heard of the Gutеnberg update which was merged into WordPress in December 2018.
So if you are using the latest version of WP, you are either already using Gutenberg or have continued using the classic editor by installing the WordPress Classic Editor plugin.
Why Gutenberg?
Many WP users are not ready to jump on the Gutenberg wagon, but some are, including this website.
A few of the reasons why you might want to use Gutenberg are because it:
- Is the future for WP developers.
- Provides a better user experience.
- Is more flexible that WP’s original editor (TinyMCE).
- Will provide a new market for developers.
What Are The Differences Between WordPress & Gutenberg?
WP’s Classic Editor is a text editor and looks very much like Microsoft Word. It has a single editing field as seen in the screenshot below.
Gutenberg is a block-based editor that looks like this:
There are multiple blocks for different types of content that include their own formatting options. Blocks such as:
- Button
- Image
- Table
- Embeds
- List
- Gallery
- Audio
- Quotes
- Heading
- Code
- Verse
- Custom HTML
Also, themes and plugins offer more blocks and widgets for you to use in your WP posts and pages.
How Are Existing Pages Or Posts Affected?
After upgrading and using Gutenberg, your existing pages and posts should continue to display correctly.
However, you should check your shortcodes and make sure that the plugins you might be using are working.
When you edit an existing page or post, it will automatically open in a single new Gutenberg editor classic block.
Are you ready to make the switch?
Use a Staging Site
The last thing you want to do is break your existing site. The way to avoid this is to activate Gutenberg on a staging site. This is an exact replica of your website where you can test things out without doing any damage to your live site.
Test sites include your theme, plugins, options, and content. Your hosting company might offer staging sites. If they don’t, you can use the WordPress Staging plugin.
After your staging site is up and running, install and activate the Gutenberg plugin and start testing. Or install a brand new instance of WordPress on your computer and test on there.
Check Your Plugins
WordPress users are familiar with what happens when plugins don’t play nice together. Sometimes it’s due to the functionality or conflicting code. This is an excellent time to see if you are using all the plugins you have installed. If you aren’t, remove them.
You also want to see which plugins are being used when you are editing content in WordPress. Specific plugins such as Akismet, Contact Form 7, Google Sitemap Generator, and WP Super Cache have nothing to do with the editor and will not be affected by using Gutenberg.
On the other hand, any plugin that adds functionality or changes the way the WP classic editor looks might not be compatible with Gutenberg. In particular, plugins that generated shortcodes, adds custom styles, or haven’t been updated recently, usually conflict and cause problems.
Gutenberg used to have an active Plugin Compatibility database. However, it has been shut down because it is no longer actively maintained.
You can review the final data and download the database as a CSV file. Without access to an active plugin compatibility database, you are going to have to manually test each plugin you use.
Try creating a new post on your test site. You will see that you are in the Gutenberg editor and it will look different to you. When you start typing, you are automatically creating a paragraph block. You don’t have to add a new block when you add a new paragraph. Just hit enter or the return key.
Since you are trying to see if your current plugins will work, try to recreate how you used each one and see if it still works.
If it doesn’t, look for the same functionality in the default Gutenberg block, add that block, and add your content.
Be sure to keep a list of the plugins that don’t work correctly so you can remove them when going live with Gutenberg.
What If There Is No Default Block For The Functionality You Need?
Check all the blocks to see if the functionality you need lives inside another block. If you can’t find something that will work, you can contact the plugin authors and ask them if they are planning to update it to be compatible with Gutenberg.
If all else fails, try to find a Gutenberg plugin that does what you need. Delete the plugins that don’t work from your staging site.
Going Live
Before you do ANYTHING to your live site, make a complete backup of your entire site in case you missed something when checking for compatibility or another error occurs.
It is possible to make all the necessary changes on your test site and push them to your live site. However, this requires some technical knowledge. So, unless you are a developer or have one that works for you, it is better to make the changes manually.
Start by deleting the plugins that didn’t work and adding the new ones you found to replace them. If old plugins are processing data for existing posts and pages and do not break new ones, you can leave them installed.
Do You Want To Convert Your Old Posts & Pages To Gutenberg Blocks?
Open each page and post from the Classic Block Menu. Click the three dots to view options. Select from the drop-down menu Convert to Blocks.
After WP converts your content to the Gutenberg block system, you should review each block. Use Block Navigation (from icons) to see all the parts of your post or page.
As you can see in the above screenshot, every paragraph, image, list, and heading is now in its own block. Converting existing pages and posts to the new Gutenberg system is quick and easy.
It might take several hours to test your plugins and find new ones, but you only have to do this once. Make sure to follow the steps suggested above to make your move to Gutenberg painless and error-free.