An open API service indexing awesome lists of open source software.

https://github.com/palmiak/timber-acf-wp-blocks

Create Gutenberg blocks from Twig templates and ACF fields.
https://github.com/palmiak/timber-acf-wp-blocks

hacktoberfest twig-templates

Last synced: about 1 year ago
JSON representation

Create Gutenberg blocks from Twig templates and ACF fields.

Awesome Lists containing this project

README

          



# Timber ACF WP Blocks
Generate ACF Gutenberg blocks just by adding templates to your Timber theme. This package is based heavily on [this article](https://medium.com/nicooprat/acf-blocks-avec-gutenberg-et-sage-d8c20dab6270) by [nicoprat](https://github.com/nicooprat) and the [plugin](https://github.com/MWDelaney/sage-acf-wp-blocks) by [MWDelaney](https://github.com/MWDelaney).

## Complete documentation
[Read the complete documentation](https://palmiak.github.io/timber-acf-wp-blocks/#/)

## Contributors
This plugin is build with help of contributors:
- [roylodder](https://github.com/roylodder)
- [BrentWMiller](https://github.com/BrentWMiller)
- [Marcin Krzemiński](https://github.com/marcinkrzeminski)
- [Kuba Mikita](https://github.com/Kubitomakita)
- [LandWire](https://github.com/landwire)
- [Viktor Szépe](https://github.com/szepeviktor)

## Creating blocks
Add twig templates to `views/blocks` which get and use ACF data. Each template requires a comment block with some data in it:
```twig
{#
Title: Testimonial
Description: Customer testimonial
Category: formatting
Icon: admin-comments
Keywords: testimonial quote "customer testimonial"
Mode: edit
Align: left
PostTypes: page post
SupportsAlign: left right
SupportsMode: false
SupportsMultiple: false
#}


{{ fields.testimonial }}



{{ fields.author }}

[data-{{ block.id }}] {
background: {{ fields.background_color }};
color: {{ fields.text_color }};
}

```

## Timber 2.0
**Timber ACF WP Blocks** is fully compatible with both **Timber 1.x** and **Timber 2.x** versions.