我正在学习 Udemy WordPress 课程来创建自定义 WordPress 块主题。我成功在 function.php 中注册了块类型,并且可以在古腾堡编辑器中选择我的块。
教程建议使用以下方法来加载我的 gutenberg 块元素的样式,这样 css 也会加载到前端。
function lr_theme_features() {
// Enqueue editor styles
// Borrowed from TwentyTwentyToTheme
add_editor_style( 'style.css' );
add_theme_support('editor-styles');
}
add_action('after_setup_theme', 'lr_theme_features');
无论如何,无论我做什么,古腾堡都不会加载我的块的 style.css 文件。
来自古腾堡后端的图像
有什么提示吗?我可能缺少什么或者如何调试问题?
非常感谢!
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号