Important
Go to the Block Development Examples Web App to navigate through the examples
Welcome to the block-development-examples
repo on GitHub. Here you can find a bunch of block-related examples for WordPress that you can use to learn about Block Development.
Check the code, download the plugin zip π¦ or see a playground-powered live demo of each example
Example | Description | Tags | Download .zip | Live Demo |
---|---|---|---|---|
Basic Block with Dynamic Rendering | Demonstrates how to create a block that renders its content dynamically on the server side rather than saving static content in the post content. | dynamic-rendering create-block |
π¦ | |
Basic Block with Translations | Shows how to implement internationalization (i18n) in a WordPress block using both PHP and JavaScript translations, demonstrating proper setup of translation files and functions. | static-rendering |
π¦ | |
Block with Static Rendering | Illustrates how to create a block that saves its content as static HTML in the post content, showing the basic pattern for static block rendering. | static-rendering create-block |
π¦ | |
Block Editable | Shows how to create a block with editable content using the block editor's core editing components and attributes. | π¦ | ||
Non-block wp data with React | Demonstrates how to use @wordpress/data with React components outside of the block editor context, showing data management patterns. | no-block wp-data |
π¦ | |
Minimal Block | A bare-bones example showing the minimum required code to create a functional WordPress block. | minimal featured |
π¦ | |
Minimal Gutenberg Block (No Build) | Shows how to create a simple block without a build process, using vanilla JavaScript and WordPress's built-in scripts. | minimal no-build |
π¦ | |
Interactive Blocks | Collection of examples showing how to create blocks with interactive features and client-side functionality. | interactive-block multi-block |
π¦ | |
Format API | Demonstrates how to use the WordPress Format API to add custom text formatting options to the editor. | no-block |
π¦ | |
Stylesheets | Shows different approaches to adding and managing styles in blocks, including editor-specific and front-end styles. | styles featured |
π¦ | |
Basic ESNext | Demonstrates how to create a basic block using modern JavaScript (ESNext) and JSX syntax with a build process powered by @wordpress/scripts. | minimal |
π¦ | |
Block Supports | Showcases how to use WordPress block supports to add standard features like alignment, colors, and typography to blocks. | supports featured |
π¦ | |
Dynamic Block | Shows how to create blocks that render content dynamically using PHP, including data fetching and server-side rendering. | dynamic-rendering |
π¦ | |
Interactivity API Block | Demonstrates the usage of WordPress's Interactivity API to create blocks with enhanced interactive capabilities. | create-block-template interactive-block interactivity-api |
π¦ | |
Meta Block | Shows how to create blocks that read and save data to post meta, demonstrating integration with WordPress metadata system. | meta |
π¦ | |
Inner Blocks | Demonstrates how to create blocks that can contain other blocks using InnerBlocks component. | π¦ | ||
SlotFill | Shows how to use WordPress SlotFill system to extend the editor interface with custom components. | no-block slotfill |
π¦ | |
Block Toolbar Controls | Demonstrates how to add custom controls to the block toolbar for enhanced block editing capabilities. | block-toolbar |
π¦ | |
Recipe | A practical example showing how to create a complex block for recipe content with multiple editable fields and structured data. | π¦ | ||
Plugin Sidebar | Shows how to add a custom sidebar to the editor using SlotFill and integrate it with post meta data. | slotfill meta no-block |
π¦ | |
Data Basics - @wordpress/data | Introduction to using @wordpress/data for state management in WordPress, covering basic concepts and patterns. | no-block wp-data featured |
π¦ | |
Copyright Date Block | Example of a block that combines both static and dynamic rendering to display copyright information. | dynamic-rendering static-rendering create-block featured |
π¦ | |
Interactivity API Countdown | Advanced example showing how to create an interactive countdown timer using the WordPress Interactivity API. | dynamic-rendering interactive-block interactivity-api experimental block-toolbar |
π¦ | |
Block Settings Sidebar | Demonstrates how to add custom settings panels to the block sidebar for additional block configuration options. | π¦ | ||
Post Meta Modal | Shows how to create a modal interface for editing post meta data outside of the block context. | meta no-block |
π¦ | |
Interactivity API Quiz | Demonstrates building an interactive quiz interface using the WordPress Interactivity API. | interactive-block interactivity-api |
π¦ | |
Interactivity Router (regions) example | Shows how to implement client-side routing in blocks using the WordPress Interactivity API router functionality. | interactivity-api interactivity-router |
π¦ | |
Server Side Render Block | This example demonstrates how to build a simple block that is rendered on the server and displayed in the Editor using the ServerSideRender component. |
server-side-rendering |
π¦ |
Check the WIKI of this repo for more info about it: