private static function autoload_field($file_name)
{
$file_found = false;
// Lets first look at the custom lib directory in case custom fields were created
// to overrule the one that came with Fewbricks.
$template_path = get_stylesheet_directory() . '/fewbricks/acf/fields/' . $file_name;
if (is_file($template_path)) {
include $template_path;
$file_found = true;
} else {
$lib_path = __DIR__ . '/acf/fields/' . $file_name;
if (is_file($lib_path)) {
include $lib_path;
$file_found = true;
}
}
if (!$file_found) {
wp_die('
<h1>Error message from Fewbricks.</h1>
<p>Could not locate field ' . $file_name . '.<br>
I looked in ' . $template_path . ' and ' . $lib_path . '.</p>
');
}
}