AdvancedCustomFields / AdvancedCustomFields/acf

Block Template Overriding

Open
#231 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Hi @elliotcondon,

I am looking for a way / best practice to allow users to override default Block templates come with my ACFBlocks plugin. So, for example, I have a testimonial acf block which has a template comes with my plugin, but I want to let a theme developer/user override the template easily by adding the template file/folder to the theme directory and the testimonial block (or any block) prioritize the theme folder to pick the template instead of one available in the plugin itself.

Any hints/direction would be really helpful.

Note: Also planning to add multiple block styles that may pick different templates, that to be explored. Any hints for that would be great too.

TIA

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the ACFBlocks plugin's block-template loading entry point and how it currently locates templates. Define how a theme template or folder should take priority over the plugin template, and separately assess how multiple block styles could select different templates. Done should include an agreed override convention and documented behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.