Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. jQuery(document).ready( function($) {
  2. $("#wp-admin-bar-maintenance").click( function() {
  3. var data = { action: 'maintenance' };
  4.  
  5. $.post(maintenance.ajaxurl, data, function(response) {
  6. $(".maintenance-icon").toggleClass('flicker');
  7. });
  8.  
  9. return false;
  10. });
  11. });
  12.  
  13. function maintenance_adminbar() {
  14. global $wp_admin_bar;
  15.  
  16. if( current_user_can( 'manage_options' ) ){
  17. if(get_option( 'maintenance' ) == true) {
  18. $wp_admin_bar->add_menu(array(
  19. 'id' => 'maintenance',
  20. 'title' => __('Maintenance') . get_option('maintenance'),
  21. 'href' => '#',
  22. 'meta' => array(
  23. 'class' => 'maintenance-icon flicker'
  24. )
  25. ));
  26. } else {
  27. $wp_admin_bar->add_menu(array(
  28. 'id' => 'maintenance',
  29. 'title' => __('Maintenance') . get_option('maintenance'),
  30. 'href' => '#',
  31. 'meta' => array(
  32. 'class' => 'maintenance-icon'
  33. )
  34. ));
  35. }
  36. }
  37.  
  38. }
  39. add_action('admin_bar_menu', 'maintenance_adminbar', 9999);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement