Building Custom Gutenberg Blocks: From Static to Dynamic
summary
Builds a real Gutenberg alert block that moves from static HTML to a dynamic, API-backed component using webpack + Babel, JSX and React, React‑Bootstrap, SCSS and NPM. The example creates two bundles (blocks admin bundle and lighter front-end bundle), declares attributes (including a meta-backed alert type), uses WP hooks and the REST API to fetch a remote post ID for live content, and adds Inspector Controls. It renders via PHP render_callback for safe front-end output but notes extra setup — registering scripts on the front end and exposing meta in REST — is required.
AI-written summary · about
chapters (19)
- 0:00Start
- 3:38Do You Need Web Pack
- 4:21What Is Jsx
- 5:32Block Attributes
- 5:50Block Attribute Types
- 6:32Wordpress Rest Api
- 6:59Commit History
- 15:03Wp Hooks
- 31:41Wordpress
- 42:26What Is a Component in the Context of a React Wordpress Javascript
- 1:03:53Import Toolbar from Wordpress Components
- 1:16:48A Dynamic Block
- 1:31:57How To Use a Php Render Callback
- 1:32:15Php Render Callback
- 1:37:02Capabilities Check
- 1:37:35Rest Api Request
- 1:45:57Abstraction Layer
- 1:56:19Nested Blocks
- 1:57:38Shared Blocks
