Posts Tagged ‘hacks’

use following code to show the admin bar only for the admin of your website

 

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

To show any warning message or notices in your wordpress admin panel/ dashboard use below code in your theme function.php file

 

function showMessage($message, $errormsg = false)
{
	if ($errormsg) {
		echo '<div id="message">';
	}
	else {
		echo '<div id="message">';
	}
	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');

If you like to remove the functionality of dragging of metaboxes within the admin area and dashboard  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' );