增强套件,可改进"高级自定义字段"管理
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

143 lines
4.3 KiB

  1. <?php
  2. if(!defined('ABSPATH'))
  3. exit;
  4. // Check setting
  5. if(!acf_get_setting('acfe/modules/ui'))
  6. return;
  7. /**
  8. * User Edit View
  9. */
  10. add_action('admin_footer-profile.php', 'acfe_better_user_edit_admin_footer');
  11. add_action('admin_footer-user-edit.php', 'acfe_better_user_edit_admin_footer');
  12. function acfe_better_user_edit_admin_footer(){
  13. ?>
  14. <script type="text/html" id="tmpl-acf-column-2">
  15. <div class="acf-column-2">
  16. <div id="poststuff" class="acfe-acfe-bt-admin-column">
  17. <div class="postbox">
  18. <h2 class="hndle ui-sortable-handle"><span><?php _e('Edit', 'acfe'); ?></span></h2>
  19. <div class="inside">
  20. <div class="submitbox">
  21. <div id="major-publishing-actions">
  22. <div id="publishing-action">
  23. <div class="acfe-form-submit">
  24. <input type="submit" class="acf-button button button-primary button-large" value="<?php _e('Update', 'acfe'); ?>" />
  25. <span class="acf-spinner"></span>
  26. </div>
  27. </div>
  28. <div class="clear"></div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <?php do_meta_boxes('user-edit', 'side', array()); ?>
  34. </div>
  35. </div>
  36. </script>
  37. <script type="text/javascript">
  38. (function($){
  39. // ACF Extended UI
  40. $('.wrap').addClass('acfe-ui');
  41. // wrap form
  42. $('.acfe-ui > form').wrapInner('<div class="acf-columns-2"><div class="acf-column-1"></div></div>');
  43. // add column side
  44. $('.acfe-ui > form .acf-columns-2').append($('#tmpl-acf-column-2').html());
  45. // hide native button
  46. $('.acfe-ui > form p.submit').hide();
  47. })(jQuery);
  48. </script>
  49. <?php
  50. }
  51. /**
  52. * User Add View
  53. */
  54. add_action('admin_footer-user-new.php', 'acfe_better_user_new_admin_footer');
  55. function acfe_better_user_new_admin_footer(){
  56. ?>
  57. <script type="text/html" id="tmpl-acf-column-2">
  58. <div class="acf-column-2">
  59. <div id="poststuff" class="acfe-acfe-bt-admin-column">
  60. <div class="postbox">
  61. <h2 class="hndle ui-sortable-handle"><span><?php _e('Edit', 'acfe'); ?></span></h2>
  62. <div class="inside">
  63. <div class="submitbox">
  64. <div id="major-publishing-actions">
  65. <div id="publishing-action">
  66. <div class="acfe-form-submit">
  67. <input type="submit" class="acf-button button button-primary button-large" value="<?php _e('Add New User'); ?>" />
  68. <span class="acf-spinner"></span>
  69. </div>
  70. </div>
  71. <div class="clear"></div>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. <?php do_meta_boxes(get_current_screen(), 'side', array()); ?>
  77. </div>
  78. </div>
  79. </script>
  80. <script type="text/javascript">
  81. (function($){
  82. // ACF Extended UI
  83. $('.wrap').addClass('acfe-ui');
  84. // wrap form
  85. $('.acfe-ui > form').wrapInner('<div class="acf-columns-2"><div class="acf-column-1"></div></div>');
  86. // add column side
  87. $('.acfe-ui > form .acf-columns-2').append($('#tmpl-acf-column-2').html());
  88. // add title
  89. var title = $('.wrap > h1').text();
  90. $('.acfe-ui > form > div > div > table:first').before('<h2>' + title + '</h2>');
  91. // Hide native button
  92. $('.acfe-ui > form p.submit').hide();
  93. })(jQuery);
  94. </script>
  95. <?php
  96. }