-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplugin.php
70 lines (59 loc) · 1.79 KB
/
plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* Plugin Name: ACF Local JSON
* Plugin URI: https://github.com/wplit/ACF-Local-JSON/
* GitHub URI: wplit/ACF-Local-JSON/
* Description: Allows using Local JSON with ACF Pro without using a theme. Made for Oxygen Builder where the theme is disabled.
* Version: 1.0.0
* Author: David Browne
* Author URI: https://wplit.com/
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 2, as published by the
* Free Software Foundation. You may NOT assume that you can use any other
* version of the GPL.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE.
*
* @package OxygenACFLocalJSON
* @since 1.0.0
* @copyright Copyright (c) 2018, David Browne
* @license GPL-2.0+
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
add_filter('acf/settings/save_json', 'lit_acf_json_save_point');
/**
* Adds plugin directory as new location for ACF Pro to save JSON
*
* @since 1.0.0
*
* @param $path Original path
* @return new path as /acf-json/
*/
function lit_acf_json_save_point( $path ) {
// update path
$path = plugin_dir_path( __FILE__ ) . 'acf-json';
// return
return $path;
}
add_filter('acf/settings/load_json', 'lit_acf_json_load_point');
/**
* Adds plugin directory as new location for ACF Pro to load JSON
*
* @since 1.0.0
*
* @param array $paths Original path
* @return new path as /acf-json/
*/
function lit_acf_json_load_point( $paths ) {
// remove original path
unset($paths[0]);
// append path
$paths[] = plugin_dir_path( __FILE__ ) . 'acf-json';
// return
return $paths;
}