Media Modal Gutenberg 缺失样式
所以今天,我的所有网站都更新到了新版本的 WordPress 5.9.1。很好很好。但是,我在古腾堡中包含图像元素的自定义块破坏了媒体模式的样式(您可以直接在帖子中添加图像)。
我开始了一个新项目,只是为了测试它是否是我的主题或插件,但即使没有任何插件(ACF Pro 除外)并且在二十二十二主题上,如果我添加我的2022主题的functions.php文件中的注册代码,我遇到了同样的问题。
这是寄存器块代码:
add_action('acf/init', 'my_acf_init_block_types');
function my_acf_init_block_types() {
if( function_exists('acf_register_block_type') ) {
acf_register_block_type(array(
'name' => 'carousel',
'title' => __('Carrousel'),
'description' => __(''),
'render_template' => 'web/blocks/carousel.php',
'category' => 'custom-blocks',
'icon' => 'images-alt',
'keywords' => array( 'carousel', 'carrousel'),
'supports' => array( 'anchor' => true),
));
}
}
我创建了一个字段组,尝试使用数组和仅使用 URL 的图像。
我尝试过的:
- 没有插件(ACF除外)
- WP主题(2022)
- 自定义主题,没有功能
- 将注册码添加到2022主题(同样的错误)
请帮助我们这里的姐妹。
So today, all my websites were updated to the new release of WordPress 5.9.1. Good good. However, my custom blocks in Gutenberg that are containing an image element are breaking the style of the media modal (where you can add an image directly in the post).
I started a new project, just to test if it was my theme, or the plugins, but even without any plugin (except ACF Pro) and on the Twenty Twenty-Two theme, if I add my registration code in the functions.php file of 2022 theme, I get the same problem.
Here's the register-block code:
add_action('acf/init', 'my_acf_init_block_types');
function my_acf_init_block_types() {
if( function_exists('acf_register_block_type') ) {
acf_register_block_type(array(
'name' => 'carousel',
'title' => __('Carrousel'),
'description' => __(''),
'render_template' => 'web/blocks/carousel.php',
'category' => 'custom-blocks',
'icon' => 'images-alt',
'keywords' => array( 'carousel', 'carrousel'),
'supports' => array( 'anchor' => true),
));
}
}
And I've created a Field group trying the image with the array annnnnd the one using only the URL.
What I tried:
- no plugins (except ACF)
- WP theme (2022)
- custom theme with no functions
- adding the registration code to 2022 theme (same error)
Please, help a sister our here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为这是由 5.9.1 更新引起的
您可以在functions.php中使用它作为临时修复
I think it was cause by the 5.9.1 update
You can use this in functions.php as temporary fix
我已将这段代码添加到我的functions.php 文件中(最后,没什么大不了的)。
它像以前一样完美地工作。我尝试将其降级到 5.9,它也有效,但需要更多的时间/精力,并且可能会发生很多错误。
希望它能帮助不止一个。
I've added that piece of code to my functions.php file (at the end, no biggy).
It works perfectly like before. I've tried to downversion it to 5.9 and it worked as well, but it takes more time/effort and many mistakes can happen.
Hope it helps more than one.
ACF 已意识到该问题:https://github.com/AdvancedCustomFields/acf/issues/612
这是临时修复,粘贴到你的functions.php中:
ACF is aware of the issue: https://github.com/AdvancedCustomFields/acf/issues/612
Here is the temp fix, paste in your functions.php: