| | Getting the most out of WordPress
I liked almost everything about WordPress from the start. The one thing that really bugged me was the fact that after spending a lot of time developing my own theme, the Dashboard looked out of place. Seems like you should be able to at least get the backgrounds and colors to match. After a little digging, I figured out I only had to change a few things to tie everything together.
I copied wp-admin/css/colors-fresh.css to wp-admin/css/colors-custom.css and changed all the colors to match my theme (background, background-color, border-bottom-color, border-color, border-top-color and color). I then added my new color scheme to wp-admin/admin.php:
--- 41,43 ----
wp_admin_css_color('classic', __('Blue'), admin_url("css/colors-classic.css"), array('#073447', '#21759B', '#EAF3FA', '#BBD8E7'));
wp_admin_css_color('fresh', __('Gray'), admin_url("css/colors-fresh.css"), array('#464646', '#6D6D6D', '#F1F1F1', '#DFDFDF'));
+ wp_admin_css_color('custom', __('Red'), admin_url("css/colors-custom.css"), array('#6D1B1B', '#776C56', '#F9F9D9', '#AA9F8A'));
As for which color to put where, just keep good notes when you're changing the CSS. E.g., if you used colors-fresh.css as your starting point and changed #464646 to #6D1B1B in the CSS, then make the same substitution in admin.php.
I then made my color scheme the default by changing two lines in wp-admin/includes/user.php:
*** 107,112 ****
if ( !$update )
! $user->admin_color = 'fresh'; // Default to fresh for new users.
else if ( isset( $_POST['admin_color'] ) )
$user->admin_color = $_POST['admin_color'];
else
! $user->admin_color = 'fresh';
--- 107,112 ----
if ( !$update )
! $user->admin_color = 'custom'; // Default to fresh for new users.
else if ( isset( $_POST['admin_color'] ) )
$user->admin_color = $_POST['admin_color'];
else
! $user->admin_color = 'custom';
I also had to make my color schema show up on the user page by making similar changes to wp-admin/user-edit.php:
*** 206,208 ****
$current_color = get_user_option('admin_color', $user_id);
if ( empty($current_color) )
! $current_color = 'fresh';
--- 206,208 ----
$current_color = get_user_option('admin_color', $user_id);
if ( empty($current_color) )
! $current_color = 'custom';
I then changed wp-includes/registration.php so the registration page would match:
*** 160,162 ****
if ( empty($admin_color) )
! $admin_color = 'fresh';
$admin_color = blockquoteg_replace('|[^a-z0-9 _.\-@]|i', '', $admin_color);
--- 160,162 ----
if ( empty($admin_color) )
! $admin_color = 'custom';
$admin_color = blockquoteg_replace('|[^a-z0-9 _.\-@]|i', '', $admin_color);
Same thing for wp-includes/script-loader.php:
*** 427,429 ****
if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
! $color = 'fresh';
$color = $_wp_admin_css_colors[$color];
--- 429,431 ----
if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
! $color = 'custom';
$color = $_wp_admin_css_colors[$color];
One other thing I didn't like was that my users wouldn't be redirected to their post after saving it. So while I was at it, I changed wp-admin/post.php to do a different redirect:
*** 193,195 ****
$post_ID = edit_post();
- redirect_post($post_ID); // Send user on their way while we keep working
--- 193,196 ----
$post_ID = edit_post();
+ $sendback = get_permalink($post_ID);
+ wp_redirect($sendback);
Then, I decided my bloggers might be a little leary of clicking a link that says Site Admin, so I changed wp-includes/general-template.php to make it a little more personal:
*** 193,195 ****
} else {
! $link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after;
}
--- 193,196 ----
} else {
+ global $user_identity;
! $link = $before . '<a href="' . admin_url() . '">' . __($user_identity . '\'s Dashboard') . '</a>' . $after;
}
And as long as I was cleaning up, I might as well add a handy link for submitting a new post without having to launch the Dashboard at all. I found that logic in wp-includes/widgets.php:
*** 853,855 ****
<?php echo $before_title . $title . $after_title; ?>
<ul>
! <?php wp_register(); ?>
--- 853,859 ----
<?php echo $before_title . $title . $after_title; ?>
<ul>
! <?php
! if (is_user_logged_in())
! echo '<li><a href="'.admin_url('post-new.php').'">Submit New Post</a></li>';
! ?>
! <li><?php wp_register(); ?></li>
Finally, I really liked that Visit site link that's on the Dashboard. Since users should be able to easily return to a public blog after logging out, I wanted a link like that on my login page... so one final edit to wp-login.php:
*** 488,489 ****
<a href="<?php echo site_url('wp-login.php?action=register', 'login') ?>"> <?php _e('Register') ?></a> |
! <a href="<?php echo site_url('wp-login.php?action=lostpassword', 'login') ?>" title="<?php _e('Password Lost and Found') ?>"> <?php _e('Lost your password?') ?></a>
--- 491,493 ----
<a href="<?php echo site_url('wp-login.php?action=register', 'login') ?>"> <?php _e('Register') ?></a> |
! <a href="<?php echo site_url('wp-login.php?action=lostpassword', 'login') ?>" title="<?php _e('Password Lost and Found') ?>"> <?php _e('Lost your password?') ?></a> |
! <a href="<?php bloginfo('url'); ?>/" > <?php printf(__('Visit %s'), get_bloginfo('title', 'display' )); ?></a></p>
|