| 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.4 |
| 7 |
Author: Johan van der Wijk |
| 8 |
Author URI: http://www.vanderwijk.com |
| 9 |
|
| 10 |
Release notes: 1.4 Added option to remove dashboard widgets and fix for issue that was introduced by WordPress 3.4 |
| 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( 'siteurl' ); |
| 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; }</style>'; |
| 47 |
} else { |
| 48 |
$stylesheet_uri = get_bloginfo( 'siteurl' ) . '/' . PLUGINDIR . '/' . dirname( plugin_basename(__FILE__) ) . '/customize-admin.css'; |
| 49 |
echo '<link rel="stylesheet" type="text/css" href="' . $stylesheet_uri . '" />'; |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
// Remove the shadow from the left menu |
| 54 |
function ca_add_styles() { |
| 55 |
if ( get_option( 'ca_remove_shadow' ) != '' ) { |
| 56 |
echo '<style type="text/css">#adminmenushadow, #adminmenuback { background-image: none; }</style>'; |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
// Remove the shadow from the left menu |
| 61 |
function ca_remove_generator() { |
| 62 |
if ( get_option( 'ca_remove_generator' ) != '' ) { |
| 63 |
remove_action( 'wp_head', 'wp_generator' ); |
| 64 |
} |
| 65 |
} |
| 66 |
|
| 67 |
// Remove Quick Press widget from dashboard |
| 68 |
function ca_remove_dashboard_quick_press() { |
| 69 |
if ( get_option( 'ca_remove_dashboard_quick_press' ) != '' ) { |
| 70 |
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' ); |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
// Remove Plugins widget from dashboard |
| 75 |
function ca_remove_dashboard_plugins() { |
| 76 |
if ( get_option( 'ca_remove_dashboard_plugins' ) != '' ) { |
| 77 |
remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' ); |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
// Remove Recent Comments widget from dashboard |
| 82 |
function ca_remove_dashboard_recent_comments() { |
| 83 |
if ( get_option( 'ca_remove_dashboard_recent_comments' ) != '' ) { |
| 84 |
remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' ); |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
// Remove WordPress Site News widget from dashboard |
| 89 |
function ca_remove_dashboard_wordpress_news() { |
| 90 |
if ( get_option( 'ca_remove_dashboard_wordpress_news' ) != '' ) { |
| 91 |
remove_meta_box( 'dashboard_primary', 'dashboard', 'side' ); |
| 92 |
} |
| 93 |
} |
| 94 |
|
| 95 |
// Remove WordPress Other News widget from dashboard |
| 96 |
function ca_remove_dashboard_wordpress_other() { |
| 97 |
if ( get_option( 'ca_remove_dashboard_wordpress_other' ) != '' ) { |
| 98 |
remove_meta_box( 'dashboard_secondary', 'dashboard', 'side' ); |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
add_filter( 'login_headertitle', 'ca_logo_title' ); |
| 103 |
add_filter( 'login_headerurl', 'ca_logo_url' ); |
| 104 |
add_action( 'login_head', 'ca_logo_file' ); |
| 105 |
add_action( 'admin_head', 'ca_add_styles' ); |
| 106 |
add_action( 'init', 'ca_remove_generator' ); |
| 107 |
add_action( 'wp_dashboard_setup', 'ca_remove_dashboard_quick_press' ); |
| 108 |
add_action( 'wp_dashboard_setup', 'ca_remove_dashboard_plugins' ); |
| 109 |
add_action( 'wp_dashboard_setup', 'ca_remove_dashboard_recent_comments' ); |
| 110 |
add_action( 'wp_dashboard_setup', 'ca_remove_dashboard_wordpress_news' ); |
| 111 |
add_action( 'wp_dashboard_setup', 'ca_remove_dashboard_wordpress_other' ); |
| 112 |
|
| 113 |
require_once( 'customize-admin-options.php' ); |
| 114 |
?> |