Skip to content

Commit

Permalink
Update advanced-custom-fields.php
Browse files Browse the repository at this point in the history
  • Loading branch information
MWDelaney authored Mar 9, 2020
1 parent 8721a1d commit bdcf717
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions advanced-custom-fields.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Advanced Custom Fields drop-in functionality for Sage 9 and Sage 10
* Advanced Custom Fields drop-in functionality for Sage 9
* Version: 1.0
* Author: Michael W. Delaney
*/
Expand All @@ -21,12 +21,12 @@

// Set Sage9 friendly path at /theme-directory/resources/assets/acf-json

if(is_dir(get_stylesheet_directory() . '/assets/acf-json')) {
// This is Sage 9
$path = get_stylesheet_directory() . '/assets/acf-json';
if (is_dir(get_stylesheet_directory() . '/assets/acf-json')) {
// This is Sage 9
$path = get_stylesheet_directory() . '/assets/acf-json';
} else {
// This is Sage 10
$path = get_stylesheet_directory() . '/resources/assets/acf-json';
// This is Sage 10
$path = get_stylesheet_directory() . '/resources/assets/acf-json';
}

// If the directory doesn't exist, create it.
Expand All @@ -45,16 +45,11 @@
* @return string our modified local path for acf-json
*/
add_filter('acf/settings/load_json', function ($paths) {
// Sage 9 path
$paths[] = get_stylesheet_directory() . '/assets/acf-json';

if(is_dir(get_stylesheet_directory() . '/assets/acf-json')) {
// This is Sage 9
$path = get_stylesheet_directory() . '/assets/acf-json';
} else {
// This is Sage 10
$path = get_stylesheet_directory() . '/resources/assets/acf-json';
}

$paths[] = $path;
// Sage 10 path
$paths[] = get_stylesheet_directory() . '/resources/assets/acf-json';

// return
return $paths;
Expand Down

0 comments on commit bdcf717

Please sign in to comment.