Skip to content

WordPress/block-development-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Block Development Examples

Release with Examples Zips πŸ” Static Linting

Important

Go to the Block Development Examples Web App to navigate through the examples

 
Go to the Block Development Examples Web App
 

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 Image 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 πŸ“¦ Image
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 πŸ“¦ Image
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 πŸ“¦ Image
Block Editable Shows how to create a block with editable content using the block editor's core editing components and attributes. πŸ“¦ Image
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 πŸ“¦ Image
Minimal Block A bare-bones example showing the minimum required code to create a functional WordPress block. minimal featured πŸ“¦ Image
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 πŸ“¦ Image
Interactive Blocks Collection of examples showing how to create blocks with interactive features and client-side functionality. interactive-block multi-block πŸ“¦ Image
Format API Demonstrates how to use the WordPress Format API to add custom text formatting options to the editor. no-block πŸ“¦ Image
Stylesheets Shows different approaches to adding and managing styles in blocks, including editor-specific and front-end styles. styles featured πŸ“¦ Image
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 πŸ“¦ Image
Block Supports Showcases how to use WordPress block supports to add standard features like alignment, colors, and typography to blocks. supports featured πŸ“¦ Image
Dynamic Block Shows how to create blocks that render content dynamically using PHP, including data fetching and server-side rendering. dynamic-rendering πŸ“¦ Image
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 πŸ“¦ Image
Meta Block Shows how to create blocks that read and save data to post meta, demonstrating integration with WordPress metadata system. meta πŸ“¦ Image
Inner Blocks Demonstrates how to create blocks that can contain other blocks using InnerBlocks component. πŸ“¦ Image
SlotFill Shows how to use WordPress SlotFill system to extend the editor interface with custom components. no-block slotfill πŸ“¦ Image
Block Toolbar Controls Demonstrates how to add custom controls to the block toolbar for enhanced block editing capabilities. block-toolbar πŸ“¦ Image
Recipe A practical example showing how to create a complex block for recipe content with multiple editable fields and structured data. πŸ“¦ Image
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 πŸ“¦ Image
Data Basics - @wordpress/data Introduction to using @wordpress/data for state management in WordPress, covering basic concepts and patterns. no-block wp-data featured πŸ“¦ Image
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 πŸ“¦ Image
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 πŸ“¦ Image
Block Settings Sidebar Demonstrates how to add custom settings panels to the block sidebar for additional block configuration options. πŸ“¦ Image
Post Meta Modal Shows how to create a modal interface for editing post meta data outside of the block context. meta no-block πŸ“¦ Image
Interactivity API Quiz Demonstrates building an interactive quiz interface using the WordPress Interactivity API. interactive-block interactivity-api πŸ“¦ Image
Interactivity Router (regions) example Shows how to implement client-side routing in blocks using the WordPress Interactivity API router functionality. interactivity-api interactivity-router πŸ“¦ Image
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 πŸ“¦ Image
Post Meta Testimonial Shows how to create a testimonial block that uses post meta data to store and display testimonial information. meta block πŸ“¦ Image
Editor Bindings Shows how to create a block that uses editor bindings to connect custom fields to the block editor. block-bindings πŸ“¦ Image

More info

Check the WIKI of this repo for more info about it:

  1. Getting Started
  2. Examples
  3. Local Development Guide
  4. Conventions for examples
  5. Adding new examples

About

Practical examples for building WordPress blocks and extending the Editor.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 10