Contents
What can I do with a Gutenberg block?
We’ll code a block that lets you easily embed Github gists by providing the gist URL or ID. You can, obviously, adapt the code example below to any functionality you need. You could build a product gallery, pricing tables, a slider, or any other type of content you want to display.
How are ad units set in a Gutenberg template?
With Gutenberg, we simply pre-populate the content area with two ad blocks ( built with Advanced Custom Fields) and three paragraph blocks. Content editors can then dive right into content creation around the ad units. Here’s how you set the block template for posts:
How does the create Guten block framework work?
The create-guten-block framework uses that file to simply check if it’s called in the regular WordPress context (and not directly) and to load src/init.php. The init.php file is used for enqueuing all the Javascript and CSS files necessary for your block to work properly.
How are block templates used in Gutenberg content editor?
Block templates are one of my favorite new features in Gutenberg. You can specify a list of blocks that automatically appear in the content editor, and you can customize what appears in each block by default. You can also lock the template so no additional blocks can be added. This is a great replacement for metaboxes in many cases.
How to add more than one block to Guten?
Create-guten-block allows you to add more than just one block; however, it has just one block per default. Blocks.js is used to import the Javascript files necessary to run any block you built from the blocks subdirectory.
Which is the default editor for WordPress Gutenberg?
While there are many 3rd-party page builder plugins already, WordPress version 5.0 has made Gutenberg the new default editor. In today’s article, I’m going to explain how you, as a developer, can start leveraging that new editor by creating your own blocks for WordPress Gutenberg.