A new block: Cards
I recently built a fun new WordPress block to add collection of “cards” to my blog, as seen on my home page.
This block is technically two blocks: a “Cards” block and a singular “Card” block, which is repeated—reminiscent of the WordPress Buttons block. Even now, I find it incredibly helpful to look at the source code for official WordPress blocks, which has all the tried-and-true methods for just about any type of block you’re looking to build next. Don’t reinvent, iterate.
The block is dynamic, which means the block content is not stored statically in the post content, but rather rendered server-side. I could’ve done it static as well, but dynamic blocks are simple and fun to build—especially using the render file, which I don’t think many folks know about yet.
Now there is some opinionated styling—color variables in particular may not map to your theme—but you can change colors with the typical block style controls.
You can download the block from Github. I’ll consider uploading it to the official Block Directory after I tidy it up a bit.