WordPress / developer-blog-content

In this GitHub space, WordPress team coordinate content to be published on the Developer Blog. Discussion and montly meetings (first Thu) in WP Slack #core-dev-blog
36 stars 2 forks source link

Attributes: what do the source and selector properties do? #147

Closed bph closed 9 months ago

bph commented 12 months ago

Discussed in https://github.com/WordPress/developer-blog-content/discussions/138

Originally posted by **mburridge** June 29, 2023 Block attributes are typically stored in the comment delimiter, and the values are fetched from there when the block is parsed to be displayed in the editor. But did you know that attribute values can also be stored in the block content? You can use the `source` and `selector` properties to determine where in the saved block the attribute values are fetched from at parse time. This post will be an introduction to using and saving attributes - basically a friendlier and more tutorial-based version of the content in the [Attributes page](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/) in the handbook, and with more examples.
mburridge commented 10 months ago

A draft of this post is now ready for review.

mburridge commented 9 months ago

A public preview of the attributes post is now available for review: https://developer.wordpress.org/news/?p=1981&preview=1&_ppp=ec5d6c5e35

mburridge commented 9 months ago

Pre and post publishing checklist:

bph commented 9 months ago

Hi @mburridge I really like that you want through the topic one step at a time. This is an excellent post for beginners.

I went ahead and published it. 🚢

Hope, you are ok with the small changes.

Please review your post-publish check from this issue

mburridge commented 9 months ago

Now published: https://developer.wordpress.org/news/2023/09/understanding-block-attributes/