最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

media - How to extend an existing (Gutenberg) block

programmeradmin1浏览0评论

One of my Wordpress sites has a custom field for media which contains the credit for the media item. (Something like "Photo by John Doe".)

Before Gutenberg, I overwrote the default shortcode which displayed the image, to include the credit when displaying the image in the frontend. But, with Gutenberg blocks, this no longer works.

I could create a custom block from scratch which essentially would duplicate the image block, adding the credit, but this would mean a lot of unnecessary, duplicate, work.

Preferably, I somehow adjust the default's block behaviour to add some HTML to the output of the block (which will include the credit) and to insert the credit into the block.

Is this possible? How? Where do I find a resource on how to extend existing blocks?

Alternatively, from where can I copy the code of the existing image block to create my own block, based on this existing block?

发布评论

评论列表(0)

  1. 暂无评论