Skip to content

kevin-terry/timber-acf-wp-blocks

 
 

Repository files navigation

Timber ACF WP Blocks

Generate ACF Gutenberg blocks just by adding templates to your Timber theme. This package is based heavily on this article by nicoprat and the plugin by MWDelaney.

✨ Block API v3 and ACF v3 support

Automatic block.json generation, modern block registration, and full compatibility with ACF PRO 6.6+. Fully backwards compatible with existing flat file structures.

Complete documentation

Installation

This repository is an independently maintained fork with additional fixes and features that are not present in the original upstream package.

The current Composer package name is still palmiak/timber-acf-wp-blocks, so you must add this fork as a VCS repository before requiring it:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/kevin-terry/timber-acf-wp-blocks"
    }
  ],
  "require": {
    "palmiak/timber-acf-wp-blocks": "dev-master"
  }
}

Or install it with Composer after adding the vcs repository entry:

composer require palmiak/timber-acf-wp-blocks:dev-master

Warning: if you do not add the VCS repository entry for https://github.com/kevin-terry/timber-acf-wp-blocks, Composer may resolve the original upstream package instead of this fork.

Contributors

This plugin is built with help of contributors:

Creating blocks

Create a subfolder in views/blocks with a matching Twig template. The plugin auto-generates block.json from your template headers:

views/blocks/testimonial/
├── testimonial.twig
├── block.json (auto-generated)
└── example.png (optional preview image)
{#
  Title: Testimonial
  Description: Customer testimonial
  Category: formatting
  Icon: admin-comments
  Keywords: testimonial quote
  Mode: preview
  SupportsAlign: left right
#}

<blockquote data-{{ block.id }}>
    <p>{{ fields.testimonial }}</p>
    <cite>
      <span>{{ fields.author }}</span>
    </cite>
</blockquote>

<style type="text/css">
  [data-{{ block.id }}] {
    background: {{ fields.background_color }};
    color: {{ fields.text_color }};
  }
</style>

Timber 2.0

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

How can I report security bugs?

You can report security bugs through the Patchstack Vulnerability Disclosure Program. The Patchstack team helps validate, triage, and handle any security vulnerabilities. Report a security vulnerability.

About

Create Gutenberg blocks from Twig templates and ACF fields.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • PHP 100.0%