增强套件,可改进"高级自定义字段"管理
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.
 
 
 

97 lines
3.2 KiB

  1. <?php
  2. if(!defined('ABSPATH'))
  3. exit;
  4. // Check setting
  5. if(!acf_get_setting('acfe/modules/ui'))
  6. return;
  7. /**
  8. * General Options
  9. */
  10. add_action('admin_footer-options-general.php', 'acfe_better_options_general_admin_footer');
  11. add_action('admin_footer-options-writing.php', 'acfe_better_options_general_admin_footer');
  12. add_action('admin_footer-options-reading.php', 'acfe_better_options_general_admin_footer');
  13. add_action('admin_footer-options-discussion.php', 'acfe_better_options_general_admin_footer');
  14. add_action('admin_footer-options-media.php', 'acfe_better_options_general_admin_footer');
  15. add_action('admin_footer-options-permalink.php', 'acfe_better_options_general_admin_footer');
  16. function acfe_better_options_general_admin_footer(){
  17. global $pagenow;
  18. ?>
  19. <script type="text/html" id="tmpl-acf-column-2">
  20. <div class="acf-column-2">
  21. <div id="poststuff" class="acfe-acfe-bt-admin-column">
  22. <div class="postbox">
  23. <h2 class="hndle ui-sortable-handle"><span><?php _e('Settings'); ?></span></h2>
  24. <div class="inside">
  25. <div class="submitbox">
  26. <div id="major-publishing-actions">
  27. <div id="publishing-action">
  28. <div class="acfe-form-submit">
  29. <input type="submit" class="acf-button button button-primary button-large" value="<?php _e('Save Changes'); ?>" />
  30. <span class="acf-spinner"></span>
  31. </div>
  32. </div>
  33. <div class="clear"></div>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. <?php do_meta_boxes(get_current_screen(), 'side', array()); ?>
  39. </div>
  40. </div>
  41. </script>
  42. <script type="text/javascript">
  43. (function($){
  44. // ACF Extended UI
  45. $('.wrap').addClass('acfe-ui');
  46. // wrap form
  47. $('.acfe-ui > form').wrapInner('<div class="acf-columns-2"><div class="acf-column-1"></div></div>');
  48. // add column side
  49. $('.acfe-ui > form .acf-columns-2').append($('#tmpl-acf-column-2').html());
  50. <?php if(!in_array($pagenow, array('options-permalink.php', 'options-media.php'))){ ?>
  51. // add title
  52. var title = $('.wrap > h1').text();
  53. $('.acfe-ui > form > div > div > table:first').before('<h2>' + title + '</h2>');
  54. <?php } ?>
  55. $('.acfe-ui > h1').css('margin-bottom', '13px');
  56. if($('#ping_sites').length){
  57. $('#ping_sites').wrap('<table class="form-table"><tbody><td class="td-full"></td></tbody></table>');
  58. $('#ping_sites').css('width', '100%');
  59. }
  60. // Hide native button
  61. $('.acfe-ui > form p.submit').hide();
  62. })(jQuery);
  63. </script>
  64. <?php
  65. }