1
|
|
|
<?php
|
2
|
|
|
|
3
|
|
|
// Hide ACF field group menu item
|
4
|
|
|
add_filter('acf/settings/show_admin', '__return_false');
|
5
|
|
|
|
6
|
|
|
// Customize ACF path
|
7
|
|
|
add_filter('acf/settings/path', 'my_acf_settings_path');
|
8
|
|
|
|
9
|
|
|
function my_acf_settings_path( $path ) {
|
|
|
|
|
10
|
|
|
|
11
|
|
|
// update path
|
12
|
|
|
$path = get_stylesheet_directory() . '/includes/acf/';
|
13
|
|
|
|
14
|
|
|
// return
|
15
|
|
|
return $path;
|
16
|
|
|
}
|
17
|
|
|
|
18
|
|
|
// Customize ACF dir
|
19
|
|
|
add_filter('acf/settings/dir', 'my_acf_settings_dir');
|
20
|
|
|
|
21
|
|
|
function my_acf_settings_dir( $dir ) {
|
|
|
|
|
22
|
|
|
|
23
|
|
|
// update path
|
24
|
|
|
$dir = get_stylesheet_directory_uri() . '/includes/acf/';
|
25
|
|
|
|
26
|
|
|
// return
|
27
|
|
|
return $dir;
|
28
|
|
|
}
|
29
|
|
|
|
30
|
|
|
// Save ACF field as JSON
|
31
|
|
|
add_filter('acf/settings/save_json', 'my_acf_json_save_point');
|
32
|
|
|
|
33
|
|
|
function my_acf_json_save_point( $path ) {
|
|
|
|
|
34
|
|
|
|
35
|
|
|
// update path
|
36
|
|
|
$path = get_stylesheet_directory() . '/includes/acf-json';
|
37
|
|
|
|
38
|
|
|
// return
|
39
|
|
|
return $path;
|
40
|
|
|
}
|
41
|
|
|
|
42
|
|
|
// Load ACF field from JSON
|
43
|
|
|
add_filter('acf/settings/load_json', 'my_acf_json_load_point');
|
44
|
|
|
|
45
|
|
|
function my_acf_json_load_point( $paths ) {
|
46
|
|
|
|
47
|
|
|
// remove original path (optional)
|
48
|
|
|
unset($paths[0]);
|
49
|
|
|
|
50
|
|
|
// append path
|
51
|
|
|
$paths[] = get_stylesheet_directory() . '/includes/acf-json';
|
52
|
|
|
|
53
|
|
|
// return
|
54
|
|
|
return $paths;
|
55
|
|
|
}
|
56
|
|
|
|
57
|
|
|
|
58
|
|
|
/*****
|
59
|
|
|
Options Page
|
60
|
|
|
***************/
|
61
|
|
|
if( function_exists('acf_add_options_page') ) {
|
62
|
|
|
|
63
|
|
|
acf_add_options_page(array(
|
|
|
|
|
64
|
|
|
'page_title' => 'Lighthouse General Settings',
|
65
|
|
|
'menu_title' => 'Theme Settings',
|
66
|
|
|
'menu_slug' => 'lighthouse-general-settings',
|
67
|
|
|
'capability' => 'edit_posts',
|
68
|
|
|
'parent_slug' => '',
|
69
|
|
|
'redirect' => false,
|
70
|
|
|
'icon_url' => 'dashicons-layout'
|
71
|
|
|
));
|
72
|
|
|
|
73
|
|
|
acf_add_options_sub_page(array(
|
|
|
|
|
74
|
|
|
'page_title' => 'Announcement Slider',
|
75
|
|
|
'menu_title' => 'Announcement',
|
76
|
|
|
'menu_slug' => 'announcement-slider',
|
77
|
|
|
'parent_slug' => 'lighthouse-general-settings',
|
78
|
|
|
));
|
79
|
|
|
|
80
|
|
|
acf_add_options_sub_page(array(
|
|
|
|
|
81
|
|
|
'page_title' => 'Members Logo Slider',
|
82
|
|
|
'menu_title' => 'Members Logo',
|
83
|
|
|
'menu_slug' => 'members-logo-slider',
|
84
|
|
|
'parent_slug' => 'lighthouse-general-settings',
|
85
|
|
|
));
|
86
|
|
|
} |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.