From c88b4cb98e59bcb0a27810c5ac1a2fdbd82a33cb Mon Sep 17 00:00:00 2001 From: Justin Lettenmair Date: Fri, 29 Jan 2021 17:36:36 -0600 Subject: [PATCH] Update for new Sage 10 directory structure Closes #6 --- advanced-custom-fields.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/advanced-custom-fields.php b/advanced-custom-fields.php index 56b8c24..a698223 100644 --- a/advanced-custom-fields.php +++ b/advanced-custom-fields.php @@ -24,9 +24,15 @@ if (is_dir(get_stylesheet_directory() . '/assets')) { // This is Sage 9 $path = get_stylesheet_directory() . '/assets/acf-json'; - } else { - // This is Sage 10 + } elseif (is_dir(get_stylesheet_directory() . '/resources/assets')) { + // This is old Sage 10 $path = get_stylesheet_directory() . '/resources/assets/acf-json'; + } elseif (is_dir(get_stylesheet_directory() . '/resources')) { + // This is Sage 10 + $path = get_stylesheet_directory() . '/resources/acf-json'; + } else { + // This probably isn't Sage + $path = get_stylesheet_directory() . '/acf-json'; } // If the directory doesn't exist, create it. @@ -48,9 +54,15 @@ // Sage 9 path $paths[] = get_stylesheet_directory() . '/assets/acf-json'; - // Sage 10 path + // old Sage 10 path $paths[] = get_stylesheet_directory() . '/resources/assets/acf-json'; + // Sage 10 path + $paths[] = get_stylesheet_directory() . '/resources/acf-json'; + + // Failsafe path + $paths[] = get_stylesheet_directory() . '/acf-json'; + // return return $paths; });