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

A real-world use case: custom meta + block bindings + variations + usage in templates #238

Closed justintadlock closed 1 month ago

justintadlock commented 3 months ago

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

Originally posted by **justintadlock** March 1, 2024 In #222 and #225, I introduced the Block Bindings API. But I should stress that these were merely very basic introductory posts on a vast subject that will empower developers to do some really powerful things with WordPress 6.5+. With the introduction out of the way, it's time to showcase what folks can really do with this API in more of a real-world use case. I still need to map out the full plan for this, but my general idea is this: - Developer is building a site that is slightly more complex than a regular blog. _Book review website?_ - Requires custom post meta for data (e.g., rating, ISBN number, etc.). - Uses a custom Editor Plugin to add fields for entering metadata in the post sidebar. - Needs a custom post template for different structure. - Needs a custom archive template with custom Query Loop variation. - Uses the Block Bindings API to render post metadata. - Needs the Block Variations API for inserting blocks that are bound to post meta. - Could use some patterns for use in the theme and by the user with the Block Bindings already in place. - It could also showcase Block Locking to control what the user can change. Essentially, this post (maybe even series) could touch on a lot of features in WordPress and show how developers could bring them together from Point A to Point B.
justintadlock commented 2 months ago

I'm working on the code examples in this repo for the moment: https://github.com/justintadlock/tt4-book-reviews

justintadlock commented 2 months ago

I'm working on the draft for this here: https://docs.google.com/document/d/19ySkgbDNzHoHg0Ly1z1VKOFv21UByW06mu7M5TchAPA/edit?usp=sharing

justintadlock commented 2 months ago

I needed to split this into two separate posts to keep the word count at a reasonable length. The first part is now ready for review: https://docs.google.com/document/d/19ySkgbDNzHoHg0Ly1z1VKOFv21UByW06mu7M5TchAPA/edit?usp=sharing

ndiego commented 2 months ago

Just completed the 1st review and added some suggestions. Great article! 🙌

bph commented 1 month ago

I'll take the 2nd review :-)

bph commented 1 month ago

I made a few comments, but it's practically done. As always, great tutorial, @justintadlock

justintadlock commented 1 month ago

Social Copy:

Learn how to combine block bindings, custom fields, block variations, and custom editor controls in this tutorial on the Developer Blog:

https://developer.wordpress.org/news/2024/05/06/building-a-book-review-site-with-block-bindings-part-1-custom-fields-and-block-variations/

justintadlock commented 1 month ago

Post scheduled for May 13 on socials.