Skip to content

Spin up a block to show specific postmeta as dynamic block, using this template for the WordPress/create-block package.

Notifications You must be signed in to change notification settings

carstingaxion/postmeta-block-template

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A create-block template for a dynamic block using postmeta

Spin up a dynamic block to show specific post_meta as a RichText comnponent. Use this package as a template for the @wordpress/create-block script.

Usage

  1. This block template can be used by running the following command:

    npx  @wordpress/create-block --template @carstenbach/postmeta-block-template
  2. Find & Replace all occurences of POSTMETA with the snake_cased meta_key of your post_meta inside of the newly created:

    • {postmeta-block}.php
    • src/edit/index.js
  3. Run

    npm run build

Structure

Once the command has completed, the following structure will be created:

.
├── block.json
├── build
│   ├── index.asset.php
│   ├── index.js
│   ├── index.js.map
│   ├── style-index.css
│   └── style-index.css.map
├── languages
│   └── {postmeta-block}.pot
├── package.json
├── package-lock.json
├── {postmeta-block}.php
├── readme.txt
└── src
    ├── edit
    │   ├── editor.scss
    │   ├── index.js
    │   ├── level-icon.js
    │   └── level-toolbar.js
    ├── index.js
    ├── save.js
    └── style.scss

About

This template is based on https://github.com/mkaz/mkaz-block-template and its related blog post for details: https://mkaz.blog/wordpress/make-your-own-create-block-templates/

About

Spin up a block to show specific postmeta as dynamic block, using this template for the WordPress/create-block package.

Topics

Resources

Stars

Watchers

Forks

Languages

  • Mustache 87.7%
  • JavaScript 12.3%