20 PHP Snippets for Making the WordPress Admin Easier for Clients

PHOTO EMBED

Sat Nov 25 2023 07:56:13 GMT+0000 (Coordinated Universal Time)

Saved by @dmsearnbit

/**
 * Generic function to show a message to the user using WP's
 * standard CSS classes to make use of the already-defined
 * message color scheme.
 *
 * @param $message The message you want to tell the user.
 * @param $errormsg If true, the message is an error, so use
 * The red message style. If false, the message is a status
  * message, so use the yellow information message style.
 */
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>";
}    
content_copyCOPY

https://speckyboy.com/20-snippets-and-hacks-to-make-wordpress-user-friendly-for-your-clients/