Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <?php
  2.  
  3. // load custom fields
  4. require_once 'custom-fields--layouts.php';
  5. require_once 'custom-fields--meta.php';
  6. require_once 'custom-fields--press.php';
  7. require_once 'custom-fields--press-items.php';
  8. require_once 'custom-fields--room.php';
  9.  
  10. // put message in ACF interface to warn people to edit custom fields here
  11. function acf_warning( $hook ) {
  12. if ('edit.php' != $hook) {
  13. return;
  14. }
  15.  
  16. $javascript = "
  17. var acfFieldGroupEl = document.getElementById('acf-field-group-wrap');
  18.  
  19. if (acfFieldGroupEl) {
  20. var warningEl = document.createElement('h3');
  21. warningEl.innerHTML = 'WARNING: Custom Field definitions are in " . basename(__FILE__) . "';
  22. warningEl.style.color = 'red';
  23. acfFieldGroupEl.insertBefore(warningEl, acfFieldGroupEl.firstChild);
  24. }
  25. ";
  26.  
  27. wp_enqueue_script( 'acf-warning-js', '/iAmNotReal.js', array(), '1.0', true); // needed because Wordpress is weird
  28. wp_add_inline_script( 'acf-warning-js', $javascript);
  29. }
  30.  
  31. add_action('admin_enqueue_scripts', 'acf_warning');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement