forked from frankiejarrett/zing
-
Notifications
You must be signed in to change notification settings - Fork 1
/
now-you-see-me.php
51 lines (48 loc) · 966 Bytes
/
now-you-see-me.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* Plugin Name: Now You See Me!
* Description: Hide your admin panel like a boss.
* Version: 1.1.0
* Author: Jono Herrington
* Author URI: http://createstopbecreative.com
* License: GPLv2+
* Text Domain: Now You See Me
*/
/**
* Add a custom class to the body element
*
* @filter admin_body_class
*
* @return string
*/
function nysm_admin_body_class( $classes ) {
$classes .= ' now-you-see-me ';
return $classes;
}
add_filter( 'admin_body_class', 'nysm_admin_body_class' );
/**
* Modify the DOM on all admin screens
*
* @filter admin_head
*
* @return void
*/
function nysm_admin_head() {
?>
<script>
jQuery( document ).ready( function( $ ) {
$( document ).keypress( function( e ) {
if ( 104 === e.which ) {
$( 'body' ).toggleClass( 'now-you-see-me' );
}
});
});
</script>
<style type="text/css">
body.now-you-see-me #wpbody {
display: none;
}
</style>
<?php
}
add_action( 'admin_head', 'nysm_admin_head' );