FIRST STEPS WITHFIRST STEPS WITH
GUTENBERG FOR DEVELOPERSGUTENBERG FOR DEVELOPERS
MAGDALENA PACIOREK
FAQ block demo
What is Gutenberg?
What is Gutenberg?
React app
What is Gutenberg?
React app
works in the browser
works in wp-admin
What is Gutenberg?
React app
works in the browser
works in wp-admin
a library of JavaScript packages:
What is Gutenberg?
React app
works in the browser
works in wp-admin
a library of JavaScript packages:
@wordpress/components
@wordpress/block-editor
and more
@wordpress/components
https://developer.wordpress.org/block-editor/components/
Components in action
Stackable blocks - Accordion
Block design
1. content area, 2. block toolbar, 3. settings sidebar
HOW TO REGISTER A CUSTOMHOW TO REGISTER A CUSTOM
BLOCK?BLOCK?
What do we need to learn?
@wordpress/create-block
$ npm init @wordpress/block faq-block
$ cd faq-block
$ npm start
https://www.npmjs.com/package/@wordpress/create-block
Files generated by create-block tool
faq-block
|-- build
|-- node-modules
|-- src
| |-- index.js
|-- editor.css
|-- faq-block.php
|-- package.json
|-- style.css
Block code overview
import { registerBlockType } from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';
registerBlockType( 'create-block/faq-block', {
title: __( 'Faq Block', 'create-block' ),
category: 'widgets',
edit: () => {
},
save: () => {
},
} );
LET'S BUILD A FAQ BLOCKLET'S BUILD A FAQ BLOCK
FAQ - ACF version
FAQ - Gutenberg version
registerBlockType
Attributes
Edit function
wp.data.select( 'core/block-editor').getBlocks()
Save function
So what gets saved to the database?
HTML on the frontend
FAQ block - the wrapper
Let's add the number
Let's check it in the console
Do we really need to learn all that?
😱
How to start?
read the official documentation
learn a little bit about React
learn a little bit about Redux
learn how to build your own custom blocks
https://developer.wordpress.org/block-editor/developers/
https://developer.wordpress.org/block-editor/designers/
https://reactjs.org/docs/getting-started.html
https://www.youtube.com/watch?v=pgAvVxowaYU
https://egghead.io/courses/getting-started-with-redux
https://www.udemy.com/course/gutenberg/
THANK YOU!THANK YOU!
Magdalena Paciorek
just another WordPress developer
who tries to keep up with changing technologies
paciorek.magdalena@gmail.com
https://www.linkedin.com/in/paciorekmagdalena/

First steps with Gutenberg for developers - WC Prague 2020