Create custom blocks for the new Wordpress Gutenberg editor using Advanced Custom Fields.
Key Features • Installation • How to make a block • How To Use The Block • Credits • Related • License
Make an easy straightforward way for Wordpress developers to create custom Gutenberg blocks using a pipeline they are already familiar with.
Download the zipped folder from Github, and then install manually to Wordpress via upload in the admin interface.
Create testimonial.php
inside of the blocks/acf/
directory within your theme
<div class="testimonial">
<img src="https://github.com/rchipka/advanced-custom-blocks/raw/master/<? the_field('avatar'); ?>" />
<h3><? the_field('author'); ?></h3>
<span><? the_field('testimonial'); ?></span>
</div>
It's really simple! Just add the block when from the normal Gutenberg insert block menu when writing a post.
And you can add multiple blocks of the same kind, similar to the repeater field.
Here are the ways in which Advanced Custom Blocks will load block content:
# Prepend
do_action("acf/before_render_block", $attributes);
do_action("acf/before_render_block/name=$block_name", $attributes);
# Block content actions
do_action("acf/render_block", $attributes);
do_action("acf/render_block/name=$block_name", $attributes);
# Block content templates
include(get_template_directory() . "/blocks/acf/$block_name.php");
include(get_template_directory() . "/blocks/acf-$block_name.php");
# Append
do_action("acf/after_render_block", $attributes);
do_action("acf/after_render_block/name=$block_name", $attributes);
Please contribute! Just fork this repo and make a pull request.
See this thread for original project discussion.
Project by Robbie Chipka
Logo by David Aslan French (forked from Darius Dan )