Give Advice with Friendly WordPress Admin Notices

It can be very helpful to your clients if you leave some sage words of advice in their WordPress Admin.

Perhaps it’s a big bold-faced warning — or perhaps it’s something extremely helpful.  Heck, maybe you just want to be weird and throw in random quotes from the Godfather.

Here are some ideas of why leaving some notes would be helpful:

  • A client may forget to save and publish … saving content as drafts and wonder why they do not appear…
  • A client might forget to tag their blog posts with useful keywords and select multiple categories
  • A client may be tempted to edit their permalinks, not considering the their content is already indexed in Google (and performing well!)
  • Or perhaps a client may have commissioned a video tutorial of a particular area of WordPress — and what better place for them to find it than on the admin page they are using!

Let’s Do It!

I’d love to share how easy this is to do so that other WordPress developers can try it out!

We’re going to add some a hook into functions.php in our custom theme or child theme that identifies which admin page we’re on and has the ability to display a custom notice right before the title appears.

We need to figure out how to identify WHAT page we’re on before we can insert our custom messages.  Usually, this is easy to find from the URL — but just to be on the safe side, we’ll debug with a handy WordPress function —  get_current_screen — and start off our admin notices function this way:

function dbrand_notices() {
$screen = get_current_screen();
echo $screen->base;
}
add_action('admin_notices','dbrand_notices');

If you go to the plugins page, you’ll now see ‘plugins’ at the top of the page… visit the add plugin page and you’ll see ‘plugin-install’ — we’ll collect a few of these for the next example —

Example: Let’s add a polite little warning about updates — something that WordPress makes VERY tempting to do everytime your client enters their admin area.

function dbrand_notices() {
$screen = get_current_screen();
// echo $screen->base;
   if ($screen->base == 'plugins' || $screen->base == 'update-core' || $screen->base == 'plugin-install') {
      echo '<div class="updated">Updating WordPress and 3rd Party Plugins is awesome!  But please remember -- we cannot guarantee 3rd party software. If something breaks, give us a shout! -- Your Buds at <a href="http://www.dbrandmakeover.com">dBrandMakeover</a></div>';
   }
}
add_action('admin_notices','dbrand_notices');

Voila!

Truth be told — if a website’s ‘theme’ was programmed using all best known practices encouraged by WordPress.org — updates should be harmless.

But, there are a few VERY popular commercial plugins out there that I’ve learned to steer clear of as they simply do not play well with others and this bad behavior has often reared its ugly head due to a WordPress upgrade – or an upgrade to another plugin.

My advice to developers — try to avoid plugins that attempt to provide a shortcut to adding things such as widget areas, custom post types and taxonomies.  It’s well worth reading the WordPress Codex and learning how to add these to functions.php by yourself!

While you’re there — go ahead and add a few admin notices to say hi to your clients.  Want to get creative?  Embed a training video.  Go the extra mile!

 
[schema type=”person” name=”Chris Hickman” orgname=”Digital Brand Makeover” jobtitle=”WordPress Guru” url=”http://www.digitalbrandmakeover.com/author/chris-hickman/” description=”When Chris sees a client’s needs, the gears immediately start moving in his head. He has created over 150 websites and promises that the next will be better than the last. His endless quest for providing customers with lead driving, call-to-action websites with intuitive administration tools has secured him a VIP spot at dBrandMakeover. He’s a WordPress evangelist who likes to build everything from the ground up; is religiously insistent on following best known practices and confesses that he’s enjoying every moment of it.” ]

Comments

comments