Show messages or notices in the WordPress admin panel

Posted: May 27, 2012 in Wordpress
Tags: , , , ,

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');
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s