This plugin adds a custom Gutenberg blocks in the Gutenberg editor of your WordPress dashboard.
-
Download the zipped plugin. Unzip the plugin.
-
Navigate to the Plugins > Add new screen in your WordPress administrative dashboard.
-
Click Add New at the top of the page.
-
Click Upload Plugin at the top of the page.
-
Click Choose File, then find and Upload the downloaded renamed zip file.
-
After the plugin finishes installing, click Activate.
or, Go to your plugin directory from terminal and Clone this repo in wp-content/plugins directory
git clone https://github.com/imranhsayed/custom-blocks
And then activate it from Plugins screen in your WordPress administrative dashboard. -
That's it!
- This plugin uses @wordpress/scripts which installs and sets up webpack and babel config out of the box
- The
@wordpress/scripts
is installed in the root of the project. This is one single plugin that registers many blocks. - By default
@wordpress/package
usessrc/index.js
as entry point andbuild/index.js
├── build
│ └── index.js
├── node_modules
├── package-lock.json
├── package.json
└── src
├── editor.css
├── index.js
└── style.css
├── custom-functions.php
├── index.php
npm run start
: will use thesrc/index.js
as entry point and output it tobuild/index.js
for developmentnpm run build
: will use thesrc/index.js
as entry point and output it tobuild/index.js
for production
- The plugin uses ReactJS & ESNext for creating custom gutenberg block, along with PHP
- It uses Webpack to bundle all of its dependencies into one file index.js
- Has separate stylesheet for front-end & editor.
- Introduction to Gutenberg
- Create Gutenberg Block in 3 Steps
- Custom Gutenberg Block using @wordpress/scripts
- @wordpress/scripts package features
- Attributes and Components | State
- Go to WordPress Dashboard > Posts/Pages > Add New > Add block ( + icon ) > Common