acf-settings.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. // Hide ACF field group menu item
  3. add_filter('acf/settings/show_admin', '__return_false');
  4. // Customize ACF path
  5. add_filter('acf/settings/path', 'my_acf_settings_path');
  6. function my_acf_settings_path($path)
  7. {
  8. // update path
  9. $path = get_stylesheet_directory() . '/inc/acf/';
  10. // return
  11. return $path;
  12. }
  13. // Customize ACF dir
  14. add_filter('acf/settings/dir', 'my_acf_settings_dir');
  15. function my_acf_settings_dir($dir)
  16. {
  17. // update path
  18. $dir = get_stylesheet_directory_uri() . '/inc/acf/';
  19. // return
  20. return $dir;
  21. }
  22. // Save ACF field as JSON
  23. add_filter('acf/settings/save_json', 'my_acf_json_save_point');
  24. function my_acf_json_save_point($path)
  25. {
  26. // update path
  27. $path = get_stylesheet_directory() . '/inc/acf-json';
  28. // return
  29. return $path;
  30. }
  31. // Load ACF field from JSON
  32. add_filter('acf/settings/load_json', 'my_acf_json_load_point');
  33. function my_acf_json_load_point($paths)
  34. {
  35. // remove original path (optional)
  36. unset($paths[0]);
  37. // append path
  38. $paths[] = get_stylesheet_directory() . '/inc/acf-json';
  39. // return
  40. return $paths;
  41. }
  42. // Theme Options
  43. if (function_exists('acf_add_options_page')) {
  44. acf_add_options_page(array(
  45. 'page_title' => 'Department of CSE: General Settings',
  46. 'menu_title' => 'UIU Theme: CSE',
  47. 'menu_slug' => 'uiu-cse-general-settings',
  48. 'capability' => 'edit_posts',
  49. 'position' => '10.5',
  50. 'redirect' => false
  51. ));
  52. acf_add_options_sub_page(array(
  53. 'page_title' => 'Department of CSE: All Sliders',
  54. 'menu_title' => 'Slider Settings',
  55. 'parent_slug' => 'uiu-cse-general-settings',
  56. ));
  57. acf_add_options_sub_page(array(
  58. 'page_title' => 'Department of CSE: Menu Rich Contents',
  59. 'menu_title' => 'Menu Settings',
  60. 'slug' => 'uiu-cse-menu-settings',
  61. 'parent_slug' => 'uiu-cse-general-settings',
  62. ));
  63. acf_add_options_sub_page(array(
  64. 'page_title' => 'Department of CSE: API Settings',
  65. 'menu_title' => 'API Settings',
  66. 'parent_slug' => 'uiu-cse-general-settings',
  67. ));
  68. // acf_add_options_sub_page(array(
  69. // 'page_title' => 'Theme Footer Settings',
  70. // 'menu_title' => 'Footer',
  71. // 'parent_slug' => 'uiu-cse-general-settings',
  72. // ));
  73. }