- Loop WP
- Posts
- Issue #117 Loop WP
Issue #117 Loop WP
Block Bindings to the Rescue!
Hi, friend. đ
Welcome to Issue #117 of Loop WP!
đ¨ Technically, this is Issue #1 of âLoop WPâ (my rebranding of WP Wednesdays), and this is the first time Iâm sending an entire campaign from Beehiiv.
Last time, we had a quick edition of âWordPress Wednesdaysâ (now Loop WP), where we discussed what was happening in the WordPress world.
This week, this newsletter starts to get back on track with its usual format as we look at a use case for the Block Bindings API (introduced in WordPress 6.5).
Letâs go! đ
Block Bindings
The Problem
Last week, I was working on a client project and wanted to use the Featured Image block to âExpand on clickâ (in other words, open in a Lightbox), just like the Image Block.
Except you canât do this currently (and the pull request didnât make it into WordPress 6.6)
My Attempted Solution
After looking at what happens to the Image block when âExpand on clickâ is applied, I noticed that many attributes are added.
So, I replicated these attributes by testing the following plugins:
GenerateBlocks Pro (paid)
Attributes for Blocks (free)
đ¤ˇââď¸ I got some of the way there, but the problem was getting the dynamic value for the image URL.
Brian Coords to the Rescue!
đ So I took to Twitter/X and asked for help.
Some initial ideas were offered, from creating a custom block to using âblock supportsâ, but then Brian Coords came to the rescue with âBlock Bindings APIâ.
đ Brian kindly created a custom Featured Image block for me and used the Block Bindings API to add the âExpand on clickâ functionality.
đ¨âđť It worked an absolute treat, and you can grab the code for Brianâs custom plugin on GitHub.
If youâre interested in learning more practical examples about the Blocks Binding API, there are two excellent guides on the WordPress Developer blog:
Introducing Block Bindings, part 1: Connecting custom fields
Building a book review site with Block Bindings, part 2: Queries, patterns, and templates
đ Massive thanks again to Brian, and make sure you connect with him on a channel below:
briancoords.com - Iâm a massive fan of Brianâs newsletter and video content.
Thatâs it for this week đ
Normally, friend, this is the bit I tell you about next weekâs topic, but as Iâm finding my way back into writing this newsletter regularly again, Iâve not decided yet. **
đ So next week will be a surprise!
** Read this if youâre new to this newsletter or canât remember what Iâm talking about.
WordPress News & Tips
This week's excellent and insightful WordPress News & Tips:
Itâs alive! - WordPress 6.6 has dropped, and there are issues with links and styles. (WordPress)
Deep Dive - Whatâs new in WordPress 6.6: Pattern overrides, Block Bindings API, Data Views, new design tools, and much more! (Kinsta)
Cloud - GeneratePress launches Generate Cloud as a standalone and part of GeneratePress One. (GeneratePress)
Stricter Versions - Developer Advisory: Minimum version requirements on Woo developed extensions (WooCommerce)
OS MU plugins - Felix Arntz has kindly open-sourced his MU plugins on GitHub. (Felix Arntz)
Free Bricks Course - The brilliant Paul Charlton of WP Tuts has released his free Bricks mini-course, âStreamline Your Bricks Builder Workflowâ. (WP Tuts)
Editor Improvements - 15 ways to curate the WordPress editing experience. (Nick Diego)
If you have a question about this email or WordPress, reply, and I will answer you as soon as possible.
đ Until next time,
Simon