PluginProbe
Customize Admin / 1.6
Customize Admin v1.6
trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.5.1 1.6 1.6.6 1.7 1.7.4 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 1.8.2 1.8.4 1.9.0 1.9.1 1.9.2 1.9.3 1.9.4 All 29 releases
customize-admin / customize-admin.php

customize-admin.php in Customize Admin 1.6, at customize-admin.php

144 lines 5.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Customize Admin
4 Plugin URI: http://www.vanderwijk.com/wordpress/customize-admin/
5 Description: This plugin allows you to customize the appearance and branding of the WordPress admin interface.
6 Version: 1.6
7 Author: Johan van der Wijk
8 Author URI: http://www.vanderwijk.com
9
10 Release notes: 1.6 now includes a color picker for setting a background color and the option to add custom styles to the login screen.
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 */
26
27 // Title attribute for the logo on the login screen
28 function ca_logo_title() {
29 if ( get_option( 'ca_logo_url' ) != '' ) {
30 return sprintf ( __( 'Go to %1$s' ), get_option ( 'ca_logo_url' ) );
31 }
32 }
33
34 // URL for the logo on the login screen
35 function ca_logo_url($url) {
36 if ( get_option( 'ca_logo_url' ) != '') {
37 return get_option( 'ca_logo_url' );
38 } else {
39 return get_bloginfo( 'url' );
40 }
41 }
42
43 // CSS for custom logo on the login screen
44 function ca_logo_file() {
45 if ( get_option( 'ca_logo_file' ) != '' ) {
46 echo '<style>h1 a { background-image: url("' . get_option( 'ca_logo_file' ) . '")!important; background-size: auto!important; }</style>';
47 } else {
48 echo '<style>h1 a { background-image: url("' . plugins_url( 'vanderwijk.png' , __FILE__ ) . '")!important; background-size: auto!important; }</style>';
49 }
50 }
51 // CSS for custom background color
52 function ca_login_background_color() {
53 if ( get_option( 'ca_login_background_color' ) != '' ) {
54 echo '<style>body { background-color: ' . get_option( 'ca_login_background_color' ) . '!important; } </style>';
55 }
56 }
57
58 // Remove the shadow from the left menu
59 function ca_add_styles() {
60 if ( get_option( 'ca_remove_shadow' ) != '' ) {
61 echo '<style type="text/css">#adminmenushadow, #adminmenuback { background-image: none; }</style>';
62 }
63 }
64
65 // Remove the generator meta tag
66 function ca_remove_meta_generator() {
67 if ( get_option( 'ca_remove_meta_generator' ) != '' ) {
68 remove_action( 'wp_head', 'wp_generator' );
69 }
70 }
71
72 // Remove the RSD meta tag
73 function ca_remove_meta_rsd() {
74 if ( get_option( 'ca_remove_meta_rsd' ) != '' ) {
75 remove_action('wp_head', 'rsd_link');
76 }
77 }
78
79 // Remove the WLW meta tag
80 function ca_remove_meta_wlw() {
81 if ( get_option( 'ca_remove_meta_wlw' ) != '' ) {
82 remove_action('wp_head', 'wlwmanifest_link');
83 }
84 }
85
86 // Remove Quick Press widget from dashboard
87 function ca_remove_dashboard_quick_press() {
88 if ( get_option( 'ca_remove_dashboard_quick_press' ) != '' ) {
89 remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
90 }
91 }
92
93 // Remove Plugins widget from dashboard
94 function ca_remove_dashboard_plugins() {
95 if ( get_option( 'ca_remove_dashboard_plugins' ) != '' ) {
96 remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
97 }
98 }
99
100 // Remove Recent Comments widget from dashboard
101 function ca_remove_dashboard_recent_comments() {
102 if ( get_option( 'ca_remove_dashboard_recent_comments' ) != '' ) {
103 remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
104 }
105 }
106
107 // Remove WordPress Site News widget from dashboard
108 function ca_remove_dashboard_wordpress_news() {
109 if ( get_option( 'ca_remove_dashboard_wordpress_news' ) != '' ) {
110 remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
111 }
112 }
113
114 // Remove WordPress Other News widget from dashboard
115 function ca_remove_dashboard_wordpress_other() {
116 if ( get_option( 'ca_remove_dashboard_wordpress_other' ) != '' ) {
117 remove_meta_box( 'dashboard_secondary', 'dashboard', 'side' );
118 }
119 }
120
121 // CSS for custom CSS
122 function ca_custom_css() {
123 if ( get_option( 'ca_custom_css' ) != '' ) {
124 echo '<style>'. get_option( 'ca_custom_css' ) . '</style>';
125 }
126 }
127
128 add_filter( 'login_headertitle', 'ca_logo_title' );
129 add_filter( 'login_headerurl', 'ca_logo_url' );
130 add_action( 'login_head', 'ca_logo_file' );
131 add_action( 'login_head', 'ca_login_background_color' );
132 add_action( 'admin_head', 'ca_add_styles' );
133 add_action( 'login_head', 'ca_custom_css' );
134 add_action( 'init', 'ca_remove_meta_generator' );
135 add_action( 'init', 'ca_remove_meta_rsd' );
136 add_action( 'init', 'ca_remove_meta_wlw' );
137 add_action( 'wp_dashboard_setup', 'ca_remove_dashboard_quick_press' );
138 add_action( 'wp_dashboard_setup', 'ca_remove_dashboard_plugins' );
139 add_action( 'wp_dashboard_setup', 'ca_remove_dashboard_recent_comments' );
140 add_action( 'wp_dashboard_setup', 'ca_remove_dashboard_wordpress_news' );
141 add_action( 'wp_dashboard_setup', 'ca_remove_dashboard_wordpress_other' );
142
143 require_once( 'customize-admin-options.php' );
144 ?>