我想在古腾堡编辑器的特色图像块中添加一些功能。网上有一些关于如何做到这一点的帖子,包括StackExchange(第三项)上的一个问题/答案。
- https://thatdevgirl.com/blog/wordpress-featured-image-and-gutenberg
- https://digitalapps.co/gutenberg-extending-featured-image-component/
- Gutenberg Block - Post Featured Image Filter Hook
但上述内容对特色图像框没有影响。我是古腾堡的新手,所以我可能错过了半打东西。如果有人能给我指出正确的方向,我将不胜感激。window.addEventListener("load", function(event){ console.log("featured_image.js loaded and functional..."); }); var el = wp.element.createElement; function wrapPostFeaturedImage( OriginalComponent ) { return function( props ) { return ( el( wp.element.Fragment, {}, \'Prepend above\', el( OriginalComponent, props ), \'Append below\' ) ); } } wp.hooks.addFilter( \'editor.PostFeaturedImage\', \'dsplugin/wrap-post-featured-image\', wrapPostFeaturedImage );