WCATH22

Gutenberg is GREAT!
Change my mind...

https://vp-wcath22.netlify.app


Vagelis Papaioannou
Software Developer
hello@vagelis.dev

Εκεί που ήταν
όλα καλά και υπό έλεγχο...

... Gutenberg !!!

"2016 State of the World"
drama δράμα drama δράμα

TinyMCE

Classic Editor

Classic Editor

Γνώριμο περιβάλλον

Backward compatibility

Δημιουργία στηλών

Χρήση Shortcodes

Κατανάλωση ενέργειας

UX | EOL

Gutenberg

Block Editor

Νέο περιβάλλον

Backward compatibility

Δημιουργία στηλών

Theme agnostic

Ταχύτητα

Επεκτασιμότητα

Κατανάλωση ενέργειας

Block Editor

React ( JS Library ) - NPM ( Node Package Manager ) - JSX ( Javascript XML )

Case Studies

CRANLEIGH

Fishmongers

Chieftain

Reviews

The future is coming.
Gutenberg’s purpose is awesome.

I build websites constantly in wordpress and this mandatory forcing of the new editor has broken my process. Make it optional, it still isn’t as powerful as many third party builders like WP bakery and has added days of dev time to my latest project. Please please think about how you are going to fix this for the people who use your product the most.

Block Editor

Ιμπόρταντ Κουέστιον

Classic ή Gutenberg


Ψήφοι: 0

HOST

Results ( if any )

, CLASSIC, GUTENBERG , 0, 0

Page Editors

Δημιουργία στηλών

Theme agnostic

Ταχύτητα

Επεκτασιμότητα

Κατανάλωση ενέργειας

Block registration - PHP

				  
					add_action('acf/init', 'my_register_blocks');
						function my_register_blocks() {

							// check function exists.
							if( function_exists('acf_register_block_type') ) {

								// register a testimonial block.
								acf_register_block_type(array(
									'name'              => 'testimonial',
									'title'             => __('Testimonial'),
									'description'       => __('A custom testimonial block.'),
									'render_template'   => get_template_directory() . '/template-parts/blocks/testimonial/testimonial.php',
									'enqueue_style'     => get_template_directory_uri() . '/template-parts/blocks/testimonial/testimonial.css',
								));
							}
						}
				
			
/wp-content/themes/mytheme/inc/blocks.php

Block Template - PHP

				  
						/**
						* Testimonial Block Template.
						*
						* @param   array $block The block settings and attributes.
						* @param   string $content The block inner HTML (empty).
						* @param   bool $is_preview True during AJAX preview.
						* @param   (int|string) $post_id The post ID this block is saved to.
						*/

						// Create id attribute allowing for custom "anchor" value.
						$id = 'testimonial-' . $block['id'];
						if( !empty($block['anchor']) ) {
							$id = $block['anchor'];
						}

						// Create class attribute allowing for custom "className" and "align" values.
						$className = 'testimonial';
						if( !empty($block['className']) ) {
							$className .= ' ' . $block['className'];
						}
						if( !empty($block['align']) ) {
							$className .= ' align' . $block['align'];
						}

						// Load values and assing defaults.
						$text = get_field('testimonial') ?: 'Your testimonial here...';
						$author = get_field('author') ?: 'Author name';
						$role = get_field('role') ?: 'Author role';
						$image = get_field('image') ?: 295;
						$background_color = get_field('background_color');
						$text_color = get_field('text_color');

						?>
						
/wp-content/themes/mytheme/template-parts/blocks/testimonial/testimonial.php

Block registration - JS

					
						npx @wordpress/create-block todo-list
						cd todo-list
						npm start
					
				
npx @wordpress/create-block [options] [slug]
It creates a WordPress plugin that you need to install manually.

edit.js

					
						/**
						* Retrieves the translation of text.
						*
						* @see https://developer.wordpress.org/block-editor/packages/packages-i18n/
						*/
						import { __ } from '@wordpress/i18n';

						/**
						* React hook that is used to mark the block wrapper element.
						* It provides all the necessary props like the class name.
						*
						* @see https://developer.wordpress.org/block-editor/packages/packages-block-editor/#useBlockProps
						*/
						import { useBlockProps } from '@wordpress/block-editor';

						/**
						* Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.
						* Those files can contain any CSS code that gets applied to the editor.
						*
						* @see https://www.npmjs.com/package/@wordpress/scripts#using-css
						*/
						import './editor.scss';

						/**
						* The edit function describes the structure of your block in the context of the
						* editor. This represents what the editor will render when the block is used.
						*
						* @see https://developer.wordpress.org/block-editor/developers/block-api/block-edit-save/#edit
						*
						* @return {WPElement} Element to render.
						*/
						export default function Edit() {
							return (
								

{__('VP WCATH 2022 – hello from the editor!', 'vp-wcath-2022')}

); }
edit.js

save.js

					
						/**
						* Retrieves the translation of text.
						*
						* @see https://developer.wordpress.org/block-editor/packages/packages-i18n/
						*/
						import { __ } from '@wordpress/i18n';

						/**
						* React hook that is used to mark the block wrapper element.
						* It provides all the necessary props like the class name.
						*
						* @see https://developer.wordpress.org/block-editor/packages/packages-block-editor/#useBlockProps
						*/
						import { useBlockProps } from '@wordpress/block-editor';

						/**
						* The save function defines the way in which the different attributes should
						* be combined into the final markup, which is then serialized by the block
						* editor into `post_content`.
						*
						* @see https://developer.wordpress.org/block-editor/developers/block-api/block-edit-save/#save
						*
						* @return {WPElement} Element to render.
						*/


						export default function save() {
							return (
								<>
									

{__("VP WCATH 2022 – hello from the saved content!", "vp-wcath-2022")}

); }
save.js

Σας ευχαριστώ πολύ για τη συμμετοχή σας.

https://vp-wcath22.netlify.app


Vagelis Papaioannou
Software Developer
hello@vagelis.dev
-->