Posted in Featured, Tutorials, Wordpress

Like this post? Share It :
  • Print
  • email
  • PDF
  • Google Bookmarks
  • Facebook
  • Twitter
  • MySpace
  • Yahoo! Buzz
  • del.icio.us
  • Digg
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Reddit
  • Technorati
  • Design Float
  • RSS

21 Most Useful WordPress Admin Page Hacks

WordPress needs no introduction among designers and writers. It use to known as the synonym for blogging but now days it is used to create any type of website of any complexity. WordPress has reached phenomenally high usage rates. There are over 70 million publishers who use WordPress, making it a popular publishing platform. These days every other WordPress blogs look more or less similar, to stand uniquely, you need to tweak it using quality hacks.

21 Most Useful WordPress Admin Page Hacks

You all must’ve known that the new version v3.3.1 is already arrived and most of you going to update (or already updated) your WordPress to v3.3.1 anyway. So, it’s a right time to implement some new hacks also.

Of Course, WordPress Codex is always the best place to learn about WordPress and its tweaks. But unfortunately, it’s too much for a simple WordPress user. This the only reason we compiled this fairly comprehensive list of the Quality WordPress Hacks to unleash the power of your favorite blogging engine.

 

One of the greatest things about blogging is the immediate feedback a blogger can get from his readers. Still it’s often possible that your readers don’t give you clear idea about their likes and dislikes. Unfortunately, there is no way to find out about visitors thinking about your blog. It’s always essential to play safe and give others what they like. This article focuses on organized collection of some of the Most Useful WordPress Hacks for your Admin Panel which will definitely make your blogging life easier.

 

How to disable dragging of metaboxes in admin panel

instantShift - Useful WordPress Admin Page Hacks

If you want to disable the functionality of dragging of metaboxes within the admin area and dashboard so the meta boxes can’t be repositioned then you need to deactivate the JS for this function. Go to functions.php in your theme folder and add following code.

function disable_drag_metabox() {
    wp_deregister_script('postbox');
}
add_action( 'admin_init', 'disable_drag_metabox' );

 

Show an urgent message in the WordPress admin panel

instantShift - Useful WordPress Admin Page Hacks

When applying changes to the theme or plugins, you might want to inform users that something important needs doing, or you want to inform other admins to not to perform any changes while you are working on specific file. Following steps shows you how to add a error or status message via adding some code to your theme’s functions.php.

Just change the string in line 14 to put the desired notification or error message.

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 showAdminMessages()
{
    showMessage("Working on Theme's function.php, Do not touch it till further notice.", true);
}
add_action('admin_notices', 'showAdminMessages');

 

How to show admin bar only for admins

instantShift - Useful WordPress Admin Page Hacks

Adding the following code into your theme’s functions.php file will only allow admins to see the admin bar.

if (!current_user_can('manage_options')) {
	add_filter('show_admin_bar', '__return_false');
}

 

How to remove menu items from admin bar (on top)

instantShift - Useful WordPress Admin Page Hacks

This hack gives you flexibility to remove the menu items from the admin bar in top section of your WordPress admin area. Go to functions.php in your theme folder and add following code.

function wps_admin_bar() {
    global $  wp_admin_bar;
    $  wp_admin_bar->remove_menu('wp-logo');
    $  wp_admin_bar->remove_menu('about');
    $  wp_admin_bar->remove_menu('wporg');
    $  wp_admin_bar->remove_menu('documentation');
    $  wp_admin_bar->remove_menu('support-forums');
    $  wp_admin_bar->remove_menu('feedback');
    $  wp_admin_bar->remove_menu('view-site');
}
add_action( 'wp_before_admin_bar_render', 'wps_admin_bar' );

 

Replace “Howdy, admin” in WordPress admin bar

instantShift - Useful WordPress Admin Page Hacks

Some people might find this silly but there are many who wants to replace the notification “Howdy, admin” from the admin bar of admin area. To do so, following code needs to be dropped into your theme’s functions.php file.

function replace_howdy( $  wp_admin_bar ) {
    $  my_account=$  wp_admin_bar->get_node('my-account');
    $  newtitle = str_replace( 'Howdy,', 'Logged in as', $  my_account->title );
    $  wp_admin_bar->add_node( array(
        'id' => 'my-account',
        'title' => $  newtitle,
    ) );
}
add_filter( 'admin_bar_menu', 'replace_howdy',25 );

 

Hide ‘help’ Tab from admin panel

instantShift - Useful WordPress Admin Page Hacks

I’ve never used the The ‘help’ tab in the top right corner of the WordPress admin area and this function is most of the time unnecessary for your clients too. With some simple CSS it’s possible to hide this tab.

Go to theme’s functions.php and add following code.

function hide_help() {
    echo '<style type="text/css">
            #contextual-help-link-wrap { display: none !important; }
          </style>';
}
add_action('admin_head', 'hide_help');

 

How to add new items to admin bar

instantShift - Useful WordPress Admin Page Hacks

Add following code to your theme’s functions.php and you can easily able to add new items to admin bar.

function wp_admin_bar_new_item() {
global $  wp_admin_bar;
$  wp_admin_bar->add_menu(array(
'id' => 'wp-admin-bar-new-item',
'title' => __('iShift Archive'),
'href' => 'http://www.instantshift.com/archive/'
));
}
add_action('wp_before_admin_bar_render', 'wp_admin_bar_new_item');

 

How to remove menu items from WordPress admin panel/dashboard

instantShift - Useful WordPress Admin Page Hacks

WordPress admin panel comes with a lot of options in the left side menu, but you can get rid of them easily if required. This hack gives you flexibility to remove the menu items from the admin panel.

just paste the following code in your theme’s functions.php file.

add_action( 'admin_menu', 'remove_links_menu' );
function remove_links_menu() {
     remove_menu_page('index.php'); // Dashboard
     remove_menu_page('edit.php'); // Posts
     remove_menu_page('upload.php'); // Media
     remove_menu_page('link-manager.php'); // Links
     remove_menu_page('edit.php?post_type=page'); // Pages
     remove_menu_page('edit-comments.php'); // Comments
     remove_menu_page('themes.php'); // Appearance
     remove_menu_page('plugins.php'); // Plugins
     remove_menu_page('users.php'); // Users
     remove_menu_page('tools.php'); // Tools
     remove_menu_page('options-general.php'); // Settings
}

 

Remove the Editor submenu item from Appearance menu

instantShift - Useful WordPress Admin Page Hacks

Removing a editor submenu from the Appearance menu is a bit tricky as it doesn’t respond to the unset() function. Use following hack to remove it from Appearance menu.

function remove_editor_menu() {
  remove_action('admin_menu', '_add_themes_utility_last', 101);
}

add_action('_admin_menu', 'remove_editor_menu', 1);

 

Change WordPress version in admin footer

instantShift - Useful WordPress Admin Page Hacks

Adding this code in your theme’s functions.php will change the version string in the bottom-right of the WordPress admin pages.

function change_footer_version() {
  return 'Version 1.0.0';
}
add_filter( 'update_footer', 'change_footer_version', 9999 );

 

Change footer text in WordPress admin panel

instantShift - Useful WordPress Admin Page Hacks

Adding this code in your theme’s functions.php will change the footer text to anything you like it to be. Just change the “My Custom footer text” string with your choice.

function remove_footer_admin () {
  echo 'My Custom footer text.';
}
add_filter('admin_footer_text', 'remove_footer_admin');

 

How to display dashboard in a single column only

instantShift - Useful WordPress Admin Page Hacks

Adding this code to the functions.php of your WordPress theme will force the WordPress admin dashboard to display in a single column only.

function single_screen_columns( $  columns ) {
    $  columns['dashboard'] = 1;
    return $  columns;
}
add_filter( 'screen_layout_columns', 'single_screen_columns' );
function single_screen_dashboard(){return 1;}
add_filter( 'get_user_option_screen_layout_dashboard', 'single_screen_dashboard' );

 

How to disable browser upgrade notification/warning

instantShift - Useful WordPress Admin Page Hacks

Many of you may have noticed the browser upgrade notification / warning on your admin panel deshboard. If you simply want to get rid of these notification / warning then add following code in your theme’s functions.php file.

function disable_browser_upgrade_warning() {
    remove_meta_box( 'dashboard_browser_nag', 'dashboard', 'normal' );
}
add_action( 'wp_dashboard_setup', 'disable_browser_upgrade_warning' );

 

How to add custom pointers in admin area

instantShift - Useful WordPress Admin Page Hacks

Many of you may have noticed pointers in your WordPress admin panel. Pointers are useful if you want to provide guidelines to your users about your theme or plugin within your admin area.

Adding following code in your theme’s functions.php file will allow you to add pointer within your admin area.

Don’t forget to put the desired label and message on line 8 & 9.

Also update the ID with jquery to assign the pointer in place of #menu-appearance in line 14. For example if you want your pointer’s tooltip to point towards media menu then use id #menu-media instead of #menu-appearance or in case of settings menu use id #menu-settings

add_action( 'admin_enqueue_scripts', 'my_admin_enqueue_scripts' );
function my_admin_enqueue_scripts() {
    wp_enqueue_style( 'wp-pointer' );
    wp_enqueue_script( 'wp-pointer' );
    add_action( 'admin_print_footer_scripts', 'my_admin_print_footer_scripts' );
}
function my_admin_print_footer_scripts() {
    $  pointer_content = '<h3>iShift | Notice</h3>';
    $  pointer_content .= '<p>Added new functions to Edit Post section and few more options for users (authors and subscribers only).</p>';
?>
   <script type="text/javascript">
   //<![CDATA[
   jQuery(document).ready( function($  ) {
    $  ('#menu-appearance').pointer({
        content: '<?php echo $  pointer_content; ?>',
        position: 'top',
        close: function() {
            // Once the close button is hit
        }
      }).pointer('open');
   });
   //]]>
   </script>
<?php
}

 

Show the count of pingbacks & trackbacks within admin post columns

instantShift - Useful WordPress Admin Page Hacks

This hack simply adds a new column called counts within the admin post columns which display the total number of pingbacks and trackbacks for each post.

Go to functions.php in your theme folder and add following code.

function commentCount($  type = 'comments'){
	if($  type == 'trackbacks'):
		$  typeSql = 'comment_type = "trackback"';
		$  oneText = 'One :trackback';
		$  moreText = '% :trackbacks';
		$  noneText = 'No :trackbacks';
	elseif($  type == 'pingbacks'):
		$  typeSql = 'comment_type = "pingback"';
		$  oneText = 'One :pingback';
		$  moreText = '% :pingbacks';
		$  noneText = 'No :pingbacks';
	endif;
	global $  wpdb;
    $  result = $  wpdb->get_var('
        SELECT
            COUNT(comment_ID)
        FROM
            '.$  wpdb->comments.'
        WHERE
            '.$  typeSql.' AND
            comment_approved="1" AND
            comment_post_ID= '.get_the_ID()
    );
	if($  result == 0):
		echo str_replace('%', $  result, $  noneText);
	elseif($  result == 1):
		echo str_replace('%', $  result, $  oneText);
	elseif($  result > 1):
		echo str_replace('%', $  result, $  moreText);
	endif;
}
add_filter('manage_posts_columns', 'posts_columns_counts', 1);
add_action('manage_posts_custom_column', 'posts_custom_columns_counts', 1, 2);
function posts_columns_counts($  defaults){
    $  defaults['wps_post_counts'] = __('Counts');
    return $  defaults;
}
function posts_custom_columns_counts($  column_name, $  id){
	if($  column_name === 'wps_post_counts'){
		commentCount('trackbacks'); echo "<br />";
		commentCount('pingbacks');
          }
}

 

How to show post attachment count in admin column

instantShift - Useful WordPress Admin Page Hacks

Adding this code to the functions.php of your WordPress theme will display the post attachment count in a custom admin column.

add_filter('manage_posts_columns', 'posts_columns_attachment_count', 5);
add_action('manage_posts_custom_column', 'posts_custom_columns_attachment_count', 5, 2);
function posts_columns_attachment_count($  defaults){
    $  defaults['wps_post_attachments'] = __('Att');
    return $  defaults;
}
function posts_custom_columns_attachment_count($  column_name, $  id){
	if($  column_name === 'wps_post_attachments'){
	$  attachments = get_children(array('post_parent'=>$  id));
	$  count = count($  attachments);
	if($  count !=0){echo $  count;}
    }
}

 

How to add featured image thumbnail to WordPress admin columns

instantShift - Useful WordPress Admin Page Hacks

The admin pages listing the site’s posts and pages come with various text columns like title, tags, categories, author and so on. In order to see what the featured images are, you have to visit each post or page individually. Using this hack you can add a column with a reasonably sized thumbnail copy of the featured image. Please note that this only works for themes that support featured images.

Just add following code to your theme’s functions.php file.

// Add the posts and pages columns filter. They can both use the same function.
add_filter('manage_posts_columns', 'tcb_add_post_thumbnail_column', 5);
add_filter('manage_pages_columns', 'tcb_add_post_thumbnail_column', 5);

// Add the column
function tcb_add_post_thumbnail_column($  cols){
  $  cols['tcb_post_thumb'] = __('Featured');
  return $  cols;
}

// Hook into the posts an pages column managing. Sharing function callback again.
add_action('manage_posts_custom_column', 'tcb_display_post_thumbnail_column', 5, 2);
add_action('manage_pages_custom_column', 'tcb_display_post_thumbnail_column', 5, 2);

// Grab featured-thumbnail size post thumbnail and display it.
function tcb_display_post_thumbnail_column($  col, $  id){
  switch($  col){
    case 'tcb_post_thumb':
      if( function_exists('the_post_thumbnail') )
        echo the_post_thumbnail( 'admin-list-thumb' );
      else
        echo 'Not supported in theme';
      break;
  }
}

 

How to hide admin post meta-boxes

instantShift - Useful WordPress Admin Page Hacks

On may places you need to provide clean or simplify WordPress admin interface for your clients. Following hack provides you facility to hide meta boxes of post section in Admin area.

Add this code to your WordPress theme’s functions.php file.

add_action( 'admin_menu', 'remove_meta_boxes' );
function remove_meta_boxes() {
	remove_meta_box( 'submitdiv', 'post', 'normal' ); // Publish meta box
	remove_meta_box( 'commentsdiv', 'post', 'normal' ); // Comments meta box
	remove_meta_box( 'revisionsdiv', 'post', 'normal' ); // Revisions meta box
	remove_meta_box( 'authordiv', 'post', 'normal' ); // Author meta box
	remove_meta_box( 'slugdiv', 'post', 'normal' );	// Slug meta box
	remove_meta_box( 'tagsdiv-post_tag', 'post', 'side' ); // Post tags meta box
	remove_meta_box( 'categorydiv', 'post', 'side' ); // Category meta box
	remove_meta_box( 'postexcerpt', 'post', 'normal' ); // Excerpt meta box
	remove_meta_box( 'formatdiv', 'post', 'normal' ); // Post format meta box
	remove_meta_box( 'trackbacksdiv', 'post', 'normal' ); // Trackbacks meta box
	remove_meta_box( 'postcustom', 'post', 'normal' ); // Custom fields meta box
	remove_meta_box( 'commentstatusdiv', 'post', 'normal' ); // Comment status meta box
	remove_meta_box( 'postimagediv', 'post', 'side' ); // Featured image meta box
	remove_meta_box( 'pageparentdiv', 'page', 'side' ); // Page attributes meta box
}

 

Hide admin color scheme options from user profile

instantShift - Useful WordPress Admin Page Hacks

Adding this code to your theme’s functions.php will hide the admin color scheme from the user profile page in admin section.

function admin_color_scheme() {
   global $  _wp_admin_css_colors;
   $  _wp_admin_css_colors = 0;
}
add_action('admin_head', 'admin_color_scheme');

 

How to change WordPress admin and login page logo

instantShift - Useful WordPress Admin Page Hacks

This one’s an old trick, but a still and good one. You can change the logo for the login page and the WordPress Admin area pages.

To change the login page logo then simply add following code to your theme’s functions.php file. Don’t forget to change the logo location in line 3.

function my_custom_login_logo() {
    echo '<style type="text/css">
        h1 a { background-image:url('.get_bloginfo('template_url').'/images/login_page_logo.png) !important; }
    </style>';
}

add_action('login_head', 'my_custom_login_logo');

To change the WordPress Admin area logo (the one which located in the top left side of your Admin panel) then simply add following code to your theme’s functions.php file. Again, Don’t forget to change the logo location in line 3.

function custom_logo() {
  echo '<style type="text/css">
    #header-logo { background-image: url('.get_bloginfo('template_directory').'/images/admin_page_logo.png) !important; }
    </style>';
}

add_action('admin_head', 'custom_logo');

 

Change WordPress default FROM email address

Adding this code into your theme’s functions.php file will change the WordPress default FROM email address, as by default, you can’t modify the FROM email adress. Don’t forget to put the desired email address on line 5 (in place of ‘admin@yourdomain.com’) and desired name on line 8 (in place of ‘Your Blog Name’).

add_filter('wp_mail_from', 'new_mail_from');
add_filter('wp_mail_from_name', 'new_mail_from_name');

function new_mail_from($  old) {
 return 'admin@yourdomain.com';
}
function new_mail_from_name($  old) {
 return 'Your Blog Name';
}

Find Something Missing?

Feel free to share any hack that you think would be a great addition in this article and that has not been listed already.


instantShift

Like this post? Share It :
  • Print
  • email
  • PDF
  • Google Bookmarks
  • Facebook
  • Twitter
  • MySpace
  • Yahoo! Buzz
  • del.icio.us
  • Digg
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Reddit
  • Technorati
  • Design Float
  • RSS

Related posts:

  1. How To Change WordPress 3.2 HTML Editor Font
  2. Customizing The WordPress Admin Interface For clients
  3. How To Create Custom Post Meta Boxes In WordPress
  4. Fix Visual Editor In WordPress
  5. Limiting The Visibility Of WordPress Posts Via Usernames

Comments are closed.