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

Blocks. How to store default settings?

programmeradmin0浏览0评论

I use a default custom image block in all my articles in 3 blogs, aligned left, link to media file.

In Gutenberg every time I upload/insert a new image I have to reconfigure those settings.

Seems stupid but it's frustrating if you only use 2-3 kind of blocks repeatedly, a long waste of time.

Is there some way to define "default settings" for some block, especially paragraph and image?

I use a default custom image block in all my articles in 3 blogs, aligned left, link to media file.

In Gutenberg every time I upload/insert a new image I have to reconfigure those settings.

Seems stupid but it's frustrating if you only use 2-3 kind of blocks repeatedly, a long waste of time.

Is there some way to define "default settings" for some block, especially paragraph and image?

Share Improve this question edited Dec 16, 2020 at 9:48 Tom J Nowell 61k7 gold badges79 silver badges148 bronze badges asked Dec 16, 2020 at 9:18 resunoizresunoiz 31 bronze badge 1
  • Is this a custom block you have written? Or are you talking about block templates? Or block patterns? Keep in mind this is a programming stack, any answer you get will need basic programming knowledge to understand, if that's not what you expected then you should ask on the support forum. If you have code can you share it? Use the edit link under the tag list to add it to your question – Tom J Nowell Commented Dec 16, 2020 at 9:46
Add a comment  | 

1 Answer 1

Reset to default 0

As Tom mentioned, you can use Templates, which allows you to define a preset of blocks that are available by default in your post whenever you try to create a new post: https://developer.wordpress/block-editor/developers/block-api/block-templates/

If you aren't ready to get your hands dirty with code, you can also use Justin Tadlock's Block Pattern Builder plugin to create and re-use block patterns across your site: http://wordpress/plugins/block-pattern-builder

Hope it helps!

发布评论

评论列表(0)

  1. 暂无评论