Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(document).ready( function($) {
- $("#wp-admin-bar-maintenance").click( function() {
- var data = { action: 'maintenance' };
- $.post(maintenance.ajaxurl, data, function(response) {
- $(".maintenance-icon").toggleClass('flicker');
- });
- return false;
- });
- });
- function maintenance_adminbar() {
- global $wp_admin_bar;
- if( current_user_can( 'manage_options' ) ){
- if(get_option( 'maintenance' ) == true) {
- $wp_admin_bar->add_menu(array(
- 'id' => 'maintenance',
- 'title' => __('Maintenance') . get_option('maintenance'),
- 'href' => '#',
- 'meta' => array(
- 'class' => 'maintenance-icon flicker'
- )
- ));
- } else {
- $wp_admin_bar->add_menu(array(
- 'id' => 'maintenance',
- 'title' => __('Maintenance') . get_option('maintenance'),
- 'href' => '#',
- 'meta' => array(
- 'class' => 'maintenance-icon'
- )
- ));
- }
- }
- }
- add_action('admin_bar_menu', 'maintenance_adminbar', 9999);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement