Json/PHP SyncPRO

Docs Modules Templates Json/PHP Sync

#Templates Sync

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

#PHP Sync

The default PHP Sync path is located in /my-theme/acfe-php/templates.

#Custom PHP Save Path

/** 
 * acfe/settings/php_save/templates
 * 
 * @string  $path      Save path
 * @array   $template  Template array
 */
filter('acfe/settings/php_save/templates',                  $path);
filter('acfe/settings/php_save/templates/all',              $path, $template);
filter('acfe/settings/php_save/templates/ID=122',           $path, $template);
filter('acfe/settings/php_save/templates/name=my-template', $path, $template);
add_filter('acfe/settings/php_save/templates/name=my-template', 'my_acfe_php_save_point', 10, 2);
function my_acfe_php_save_point($path, $template){
    
    return get_stylesheet_directory() . '/my-php-folder';
    
}

#Custom PHP Load Path

/**
 * acfe/settings/php_load/templates
 * 
 * @array  $paths  Load paths
 */
filter('acfe/settings/php_load/templates', $paths);
add_filter('acfe/settings/php_load/templates', 'my_acfe_php_load_point');
function my_acfe_php_load_point($paths){
    
    // append path
    $paths[] = get_stylesheet_directory() . '/my-php-folder';
    
    // return
    return $paths;
    
}

#Json Sync

The default Json Sync path is located in /my-theme/acf-json/templates.

#Custom Json Save Path

/**
 * acfe/settings/json_save/templates
 * 
 * @string  $path      Save path
 * @array   $template  Template array
 */

filter('acfe/settings/json_save/templates',                  $path);
filter('acfe/settings/json_save/templates/all',              $path, $template);
filter('acfe/settings/json_save/templates/ID=122',           $path, $template);
filter('acfe/settings/json_save/templates/name=my-template', $path, $template);
add_filter('acfe/settings/json_save/templates/name=my-template', 'my_acfe_json_save_point', 10, 2);
function my_acfe_json_save_point($path, $template){
    
    return get_stylesheet_directory() . '/my-json-folder';
    
}

#Custom Json Load Path

/**
 * acfe/settings/json_load/templates
 * 
 * @array  $paths  Load paths
 */

filter('acfe/settings/json_load/templates', $paths);
add_filter('acfe/settings/json_load/templates', 'my_acfe_json_load_point');
function my_acfe_json_load_point($paths){
    
    // append path
    $paths[] = get_stylesheet_directory() . '/my-json-folder';
    
    // return
    return $paths;
    
}