Gutenberg brings a powerful block editing experience with several default blocks but sometimes we may need to create custom ones. Creating Gutenberg blocks can be a challenging task as it involves writing a lot of code, even for creating a simple testimonial block. Since the process of learning JavaScript and React can be time-consuming, many developers find creating custom blocks quite complicated. Do I really need to learn JavaScript deeply to build blocks? Is there a quicker and simpler way? Well, this is where Advanced Custom Fields (ACF) come to the rescue. Through these slides, Imran will demonstrate how ACF blocks feature would help you create blocks in a very simple way.
https://2019.vadodara.wordcamp.org/creating-gutenberg-blocks-with-acf-by-imran-sayed/
3. ❖ Gutenberg is a block-based editor.
Gutenberg Blocks
#WCVadodara
4. ❖ Every content element (e.g. heading,
paragraph, or YouTube embed) is a
block.
❖ The collection of blocks makes up
the content on the page.
Gutenberg Blocks
#WCVadodara
18. ❖ Learn JavaScript and React.
❖ Requires an extra build step for code
transformation (
@wordpress/scripts can be used )
#WCVadodara
Challenges in building blocks with ES6
19. ❖ ES5 without JSX can run straight in
the browser.
❖ Locating and understanding the
compiled source code is difficult.
#WCVadodara
Challenges in building blocks with ES6
20. ❖ Tooling around JavaScript could be
intimidating.
#WCVadodara
Challenges in building blocks with ES6
26. ❖ A WordPress plugin.
What is ACF?
#WCVadodara
❖ Allows you to add extra content
fields( custom fields ) to your
WordPress edit screens.
Author : Elliot Condon
31. #WCVadodara
WordPress Block API
❖ Install packages
❖ Register Block Server
Side
❖ Register Block Client
Side
Steps Involved
Blocks
❖ Register Block Server
Side
acf_register_block_type()
❖ Create Fields
❖ Load the template
56. ● Scope
● Meta boxes save data to
‘postmeta’ table
● ACF Block data is saved
within the “post_content”
as an HTML comment
How are ACF blocks different
from meta boxes?
#WCVadodara
57. ● enqueue_block_assets :
both editor and front-end
● enqueue_block_editor_assets :
editor only
Style block differently in
editor
#WCVadodara