Last active
July 16, 2018 02:42
-
-
Save nandomoreirame/df7f062abd0b319409e20d8c01ff3822 to your computer and use it in GitHub Desktop.
Show an urgent message in the WordPress admin area
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| 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("You need to upgrade your database as soon as possible...", true); | |
| if (user_can('manage_options') { | |
| showMessage("Hello admins!"); | |
| } | |
| } | |
| add_action('admin_notices', 'showAdminMessages'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment