| 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 branding of the WordPress admin interface. |
| 6 |
Version: 1.3 |
| 7 |
Author: Johan van der Wijk |
| 8 |
Author URI: http://www.vanderwijk.com |
| 9 |
|
| 10 |
Release notes: 1.3 Added the option to remove the generator meta tag from the html source |
| 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($message) { |
| 29 |
if (get_option('ca_logo_url') != '') |
| 30 |
printf(__("Go to %s"), get_option('ca_logo_url')); |
| 31 |
else |
| 32 |
printf(__("Return to %s"), get_bloginfo('name')); |
| 33 |
} |
| 34 |
|
| 35 |
// URL for the logo on the login screen |
| 36 |
function ca_logo_url($url) { |
| 37 |
if (get_option('ca_logo_url') != '') |
| 38 |
return get_option('ca_logo_url'); |
| 39 |
else |
| 40 |
return get_bloginfo('siteurl'); |
| 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 |
// Remove the shadow from the left menu |
| 53 |
function ca_add_styles() { |
| 54 |
if (get_option('ca_remove_shadow') != '') |
| 55 |
echo '<style type="text/css">#adminmenushadow, #adminmenuback { background-image: none; }</style>'; |
| 56 |
} |
| 57 |
|
| 58 |
// Remove the shadow from the left menu |
| 59 |
function ca_remove_generator() { |
| 60 |
if (get_option('ca_remove_generator') != '') |
| 61 |
remove_action('wp_head', 'wp_generator'); |
| 62 |
} |
| 63 |
|
| 64 |
add_filter('login_headertitle', 'ca_logo_title'); |
| 65 |
add_filter('login_headerurl', 'ca_logo_url'); |
| 66 |
add_action('login_head', 'ca_logo_file'); |
| 67 |
add_action('admin_head', 'ca_add_styles'); |
| 68 |
add_action('init', 'ca_remove_generator'); |
| 69 |
|
| 70 |
require_once('customize-admin-options.php'); |
| 71 |
|
| 72 |
?> |