
Hi,
I’ve managed to create custom page templates on plugin activation but I seem to be missing the custom fields I’ve made to link to the templates themselves. So the steps I took were the following:
Step 1: Created the link to the page templates within the plugin folder.
Step 2: Extracted the advanced-custom-field-PRO on my plugin’s root folder and renamed it ‘acf’.
Step 3: Add another folder called ‘acf-json’ on the plugin’s root folder, which had my .json files.
Step 4: Created a php file to house the following code:
<?php
add_filter(‘acf/settings/path’, ‘my_acf_settings_path’);
function my_acf_settings_path( $path ) {
$path = plugin_dir_path( __FILE__ ) . ‘/acf/’;
return $path;
}
add_filter(‘acf/settings/dir’, ‘my_acf_settings_dir’);
function my_acf_settings_dir( $dir ) {
$dir = plugin_dir_path( __FILE__ ) . ‘/acf/’;
return $dir;
}
add_filter(‘acf/settings/show_admin’, ‘__return_false’);
include_once( plugin_dir_path( __FILE__ ) . ‘/acf/acf.php’ );
add_filter(‘acf/settings/load_json’, ‘my_acf_json_load_point’);
function my_acf_json_load_point( $paths ) {
unset($paths[0]);
$paths[] = plugin_dir_path( __FILE__ ) . ‘/acf-json’;
return $paths;
} ?>
Step 5: Activated the Custom PLugin, but it didn’t work.
Please help.