This wordpress theme is using Advanced Custom Fields 6 + Blocks.json to create WordPress Blocks using PHP.
This repo is a more of a reference guide for ACF 6 + Blocks.json, rather than a full-blown wordpress theme.
Use these examples to help you create ACF Blocks quickly with PHP.
- All ACF fields listed here has a cooresponding block: https://www.advancedcustomfields.com/resources/
- These blocks are written as 'bare bones' as possible, to explain how to get it to work.
- Tailwind is used to quickly lay out UI elements. It's not required.
- Blocks are listed inside the
/blocks
folder, and broken into categories. Each block contains:- REQUIRED:
block.json
file, to contain the block metadata. NOTE: to useregister_block_type()
, the file must haveblock.json
in the filename. - REQUIRED:
template.php
manages the view for both the WordPress Editor AND the User Frontend. - OPTIONAL:
style.css
if the block has custom css. This must be declared inblock.json
- OPTIONAL:
script.js
if the block has custom js. This must be declared inblock.json
- REQUIRED:
- Blocks are registered in the
/blocks/register-blocks.php
file using register_block_type();