admin管理员组文章数量:1295856
I've previously (succesfully) made gutenberg block in a plugin, and am now doing so for a theme. However, I'm getting daft errors.
I've created a block using npx @wordpress/create-block foldlayout
Then in functions.php I have include get_stylesheet_directory().'/blocks/foldlayout/foldlayout.php';
But my site seems to be requesting an odd file:
script src='http://localhost/wp-content/plugins/C:/laragon/www/wp-content/themes/fold/blocks/foldlayout/build/index.js?ver=0c1c542b672d462d63ad1563f59a52b4' id='create-block-foldlayout-editor-script-js'
Clearly this isn't right, but I can't work out how to sort it...
Info as requested:
Content of foldlayout.php:
function create_block_foldlayout_block_init() {
register_block_type_from_metadata( __DIR__ );
}
add_action( 'init', 'create_block_foldlayout_block_init' );
which is referencing block.json:
{
"apiVersion": 2,
"name": "create-block/foldlayout",
"title": "Foldlayout",
"category": "theme",
"icon": "smiley",
"description": "Example block written with ESNext standard and JSX support – build step required.",
"supports": {
"html": false
},
"textdomain": "foldlayout",
"editorScript": "file:/build/index.js",
"editorStyle": "file:./build/index.css",
"style": "file:./build/style-index.css"
}
本文标签: Error defining a gutenberg block in a theme
版权声明:本文标题:Error defining a gutenberg block in a theme 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741618425a2388667.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论