Dynamic Templates

The Dynamic Templates module let you manage default ACF values in an advanced way. In order to start, you need to connect a field group to a specific template. Head over the Field Groups administration, select the field group of your choice and scroll down to the location settings. To connect a field group to a template, choose a classic location (like Post Type = Post) and add a new rule using the “AND” operator. Select the rule “Dynamic Template” under “Forms” group, then choose your template and save the field group.

You can now fill up the template page, values will be automatically loaded for the location it is tied to. In this screenshot, there is a different template for the “Post Type: Page” & the “Post Type: Post” while using the same field group.

Location

Create a set of rules to determine edit screens

Show this field group if

and
and
ACF Extended
Howdy, ACF Extended
Edit TemplateAdd New
You are currently editing a Dynamic Template.
Field Group
Publish
Status: Published
Visibility: Public
Template Rules
  • Post Type is equal to Post

Video Showcase

The Dynamic Template system is smart enough to fulfill complex scenarios. For example, one single template can be used in conjunction with as many field group locations as needed. It is also possible to add multiple field groups into a single template to keep things organized.

Note: Template values will be loaded when the user haven’t saved any values on the related location. Typically in “New Post” or “New Term” screens. If the user save a value, even an empty one, the template won’t be loaded.

Json/PHP Sync

The module is shipped with a fully functional Json/PHP Sync feature, cousin of the native ACF Field Group Json/PHP Sync.

Learn more

Hide Module Menu

ACF Extended use the native ACF setting show_admin to determine if the module menu should be displayed or not. You can read more about that setting on the ACF article How to hide ACF menu from clients. Usage example:

add_filter('acf/settings/show_admin', '__return_false');

Disable The Module

The Templates module is enabled by default. It can be enabled and disabled in the Settings UIPRO, or with the following code:

Using acf/init

add_action('acf/init', 'my_acfe_modules');
function my_acfe_modules(){

    // disable templates
    acf_update_setting('acfe/modules/templates', false);
    
}

Using acfe/init

add_action('acfe/init', 'my_acfe_modules');
function my_acfe_modules(){
    
    // disable templates
    acfe_update_setting('modules/templates', false);
    
}