7 Awesome WordPress Admin Hacks

WordPress is extremely customisable via hooks, shortcodes, actions, filters and so on, but to get more functionality from your WordPress blog usually requires a knowledge beyond what most people are prepared to learn. After all, WordPress is about creating content – not code – despite the WordPress assertion that ‘code is poetry’. Following are seven awesome hacks for your WordPress blog that’ll make it just a little more functional and brand-friendly.

If you choose to use any of the code, you should copy it into your theme’s functions.php file or, preferably, into your custom functions plugin. All code is provided below in a single download.

Custom Administration Panel Link

On one of my aviation sites, I’ve prepared what I call the ‘Flight’ Manual. It’s a PDF document that contains all author guidelines, shortcodes and other information to make things easier for regular and guest authors. I link to it from my administration page menu.

Flight Manual

Flight Manual

You can add your own menu item or items using the following code.

// Admin Menu
function wp_admin_bar_new_item() {
global $wp_admin_bar;
$wp_admin_bar->add_menu(array(
'id' => 'wp-admin-bar-new-item',
'title' => __('Flight Manual'),
'href' => 'http://www.flight.org/my-custom-link/'
));
}
add_action('wp_before_admin_bar_render', 'wp_admin_bar_new_item');

Custom Administration Login Logo

If you’re preparing a website for a client it’s the little touches like these that count. The following code will replace the default wp-admin.php logo with one of your own choosing. If you’re a control freak, this is just another means of branding your blog.

Custom Login Form

Internoetics Custom Login Form

// Custom Admin Logo
function my_login_logo() { ?>
    <style type="text/css">
        body.login div#login h1 a {
            background-image: url(http://www.internoetics.com/images/custom_admin_logo.jpg);
            padding-bottom: 20px;
        }
    </style>
<?php }
add_action( 'login_enqueue_scripts', 'my_login_logo' );

The size of your logo should be no bigger than 323 pixels wide by 67 pixels high. Adjust the above padding-bottom value to the spacing you want between your logo and the login form.

Custom Logo Screen URL Link

The above logo code doesn’t remove the logo link to the WordPress website, nor does it remove the alt tag of “Powered by WordPress“. The following two functions will take care of that.

The first function will change the logo link.

// Custom Admin Logo Link
function change_wp_login_url() {
echo bloginfo('url');  // Or another URL
}
add_filter('login_headerurl', 'change_wp_login_url');

The second function will customise the logo title and alt text.

// Custom WP Login Title
function change_wp_login_title(){
echo get_option('blogname'); // Of your own text
}
add_filter('login_headertitle', 'change_wp_login_title');

Custom Footer Text and/or Link

In the footer of your WP install you will notice the text that says, “Thank you for creating with WordPress“. To change it to anything of your choosing, use the following function.

function remove_footer_admin () {
echo '<span id="footer-text">Site by <a href="http://www.internoetics.com" target="_blank">Internoetics</a>. Support: 02-5555-5555';
}
add_filter('admin_footer_text', 'remove_footer_admin');

If you wanted to alter the footer version (on the right hand side of the footer), you could use the following code:

Change WordPress Footer Version
function change_footer_version() {
return 'Footer Version changed to <a href="http://www.internoetics.com">link</a>';
}
add_filter( 'update_footer', 'change_footer_version', 9999);

Messages on Administration Panel

Sometimes it’s necessary to notify authors of something when they next log into your WP administration panel. This code will render a bold message at the top of the page.

WordPress Administration Message

WordPress Administration Message

// Add a custom message to the front page
function showMessage($message, $errormsg = false) {
 if ($errormsg) {
  echo '<div id="message" class="error">';
  } else {
  echo '<div id="message" class="updated fade">';
  }
 echo "<p><strong>$message</strong></p></div>";
} 

function showAdminMessage() {
showMessage("New version of Flight Manual available. Download <a href='http://www.flight.org/flight-manual.zip'>here</a>", true);
}
add_action('admin_notices', 'showAdminMessage');

Notes on Posts for Administrators Only

If you run a blog with multiple authors, it’s often useful to post a specific message to the author of that post on the specific post page. It may include corrections they’re required to make, corrections you’ve made, feedback or more dynamic elements. Usage is via the shortcode of [note]Message to be displayed in here[/note] inside the actual post content. Colors can obviously be customised.

Note Inside Post Content

Post-It-Note Inside Post Content

// Admin post-it note
function admin_post_note( $atts, $content = null ) {
  global $authordata;
  $authorname = $authordata->display_name;
  if ( current_user_can( 'publish_posts' ) )
  return '<br><p style="padding: 5px 5px 5px 5px; color: #1e0e15; border: #dd4b39 2px solid; background: #f5f5f5"><strong>Admin Message for '.$authorname.':</strong> '.$content.'</p><br>';
}
add_shortcode( 'note', 'admin_post_note' );

Change Login from ‘wp-admin.php’ to Just ‘login’

With the following changes to your site’s .htaccess file, you can change your WordPress administrator login address from yoursite.com/wp-admin.php to just yoursite.com/login. In fact, using this method, you can can your login URL to just about anything. The following may not work on your server, depending on how it’s set up.

RewriteRule ^login$ /wp-login.php [NC,L]

If you want to be nice enough to give your authors the option of using login/ (note the trailing slash), use the following instead:

RewriteRule ^login?/?$ /wp-login.php[NC,L]

When adding to your .htaccess file it’s important not to leave any white spaces at the end of each line (or under the last line).

First Name:
Your Email Address:
 




Download: Administration hacks for your WordPress Blog
Description: Administration hacks for your WordPress Blog
Author:Marty
Category: PHP code
Date: May 6, 2012



If you liked this article, you may also like:

  1. Add a WordPress Featured Image Preview to Your Posts Menu
  2. Add the WordPress Header and Footer, and Utilise the Features of WP on a non-WordPress Page
  3. Automate WordPress Posts to Twitter (with hastags, truncation and a short URL)
  4. WordPress plugin Evil
  5. Create a WordPress Author Bio with Custom Social Links
About Marty

is a passionate web developer from Sydney, Australia. He owns about 600 websites and makes a healthy living from working the web. As a day job, he works as a pilot for an international airline. Follow Marty on Twitter or Google+.

Speak Your Mind

*