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
38 stars 4 forks source link

Tutorial on how to use theme.json filters #86

Closed bph closed 1 year ago

bph commented 1 year ago

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

Originally posted by **ndiego** February 23, 2023 [theme.json filters](https://make.wordpress.org/core/2022/10/10/filters-for-theme-json-data/) were introduced in WordPress 6.1, and allow developers to modify theme.json settings and styles in unprecedented ways. Unfortunately, there is little documentation and few real-world examples. Educating the community, especially agency developers, on these new editor curation techniques would hopefully increase block adoption among an important demographic. This post should cover the following: - Illustrate the need for more editor curation tools for advanced builders. - Provide an overview theme.json filters and how they help address this need - Provide 3-4 real-world examples
ndiego commented 1 year ago

Thanks @bph I'll pick this up.

mwhiteley16 commented 1 year ago

Allowing conditionals on these filters would be nice as well. For example, if a user wants to disable specific settings only within "posts" since they typically require far less stylistic control.

ndiego commented 1 year ago

This article is ready for first review: https://docs.google.com/document/d/1f64YAP90gjRtP0KgtjAx6wiBKuhRLT1dFUJTPAKLGDw/edit

marybaum commented 1 year ago

Heading in! NIck, I do copy edits in suggestion mode โ€” Keep what works for you and broom what doesn't!

ndiego commented 1 year ago

Thank you sooo much @marybaum ๐Ÿ™Œ

marybaum commented 1 year ago

Done! See what you think, and do your damnedest!

You'll notice maybe that my edits are mostly about changing passive verbs to active ones: from

The function is used to return this

to

The function does this...

And I add copious references to You, which is any reader's favorite person (themself ... ) to keep readers engaged and remind them they have skin is this game. I like to say we talk TO readers, not ABOUT them.

The third thing I do, generally, is use the shortest, most colloquial words possible. Because I want to connect with a reader viscerally, not cerebrallyโ€” I mean, in the gut, not the headโ€”since the gut is where things stick.

ndiego commented 1 year ago

Thanks @marybaum, I greatly appreciate it. ๐Ÿ™

mburridge commented 1 year ago

Excellent article, I had nothing to add a comment on. Great job!

ndiego commented 1 year ago

Thanks for the review @mburridge

The public preview of the final draft is available.

bph commented 1 year ago

@ndiego This is a great tutorial. I am tempted to write a few customization myself ๐Ÿ˜„

I found the compare image block a little hard to decipher. I tried to add additional instructions above, but found that it doesn'tmake it easier to see the two different variations, but it's makes it even more awkward....

Screenshot 2023-07-05 at 08 48 53

I would use both image in the canvas as they are and add some caption to each. We have the space, and it's much clearer for the reader to see the difference right away.

Here again for you the two checklists before you hit the publish button.

Pre-publishing checklist:

Post-publishing checklist

ndiego commented 1 year ago

@bph thanks for reviewing and good callout. I was trying to get too fancy with it ๐Ÿ˜… I'll update the images as a two images gallery. I already updated the images at the beginning of the article and I think it works well.

ndiego commented 1 year ago

The post has been published here: How to modify theme.json data using server-side filters

Thanks to everyone who helped out!