This project is a child theme of Twenty Twenty Four that showcase different ways of extending a core block.
This child theme registers Block Styles and Variations of core/quote
block and leverage Block Bindings to customize the dynamic render of the inner paragraph for one of its variations.
The following two Block Variations are registered in this child theme:
Quote API Editor
- extendscore/quote
to allow it to fill it with a random quote from an API (optionally filtered by author) in the editor
API Quote Frontend
- extendscore/quote
by connecting its inner paragraph to a custom binding source that outputs a random quote (optionally filtered by tags) in the frontend
This project has been prepared for the event Developer Hours: Do you really need a custom block? Let’s explore alternatives that was held on July 23rd 2024 (see recording)
Resources mentioned on the Developer Hours session are available at this Google Doc
This child-theme requires that twenty-twenty-four
theme also exists in the themes
folder.
- Set up a local WordPress development environment.
- Clone / download this repository into the
wp-content/themes
folder. - Navigate to the
wp-content/themes/tt4-dh-alternatives-custom-blocks
folder in the command line. - Run
npm install
to install the themes's dependencies within a/node_modules/
folder. - Run
npm run start
to compile and watch source files for changes while developing. - Login to your local WordPress development environment, navigate from Dashboard > Themes and activate "Developer Hours - Alternatives Custom Blocks"
Refer to package.json
for additional commands.