rousnay /
lighthouse
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 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 | 'redirect' => false |
||
| 69 | )); |
||
| 70 | |||
| 71 | // acf_add_options_sub_page(array( |
||
| 72 | // 'page_title' => 'Theme Header Settings', |
||
|
0 ignored issues
–
show
|
|||
| 73 | // 'menu_title' => 'Header', |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 74 | // 'parent_slug' => 'lighthouse-general-settings', |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 75 | // )); |
||
| 76 | |||
| 77 | // acf_add_options_sub_page(array( |
||
| 78 | // 'page_title' => 'Theme Footer Settings', |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 79 | // 'menu_title' => 'Footer', |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 80 | // 'parent_slug' => 'lighthouse-general-settings', |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 81 | // )); |
||
| 82 | } |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.