Menu Close Menu
Menu
  • 0
    • Number of items in basket: 0

      • Your basket is empty.
      • Total: £0.00
      • Checkout
  • Blog
  • Extensions
  • Support
    • Documentation
    • Log a Support Ticket
  • Your Account
    • Register
  • Contact Us
  • Demo

How to Change Front End Messages

How to Change Front End Messages

Replace default customer notices with your own custom text

KB Support has a number of built-in messages that are displayed to customers during various activities taking place on the front end of your website – for example, when a ticket is submitted. We’ll refer to these messages as notices.

These front end notices can be changed if you want to do so with a small amount of code by hooking into the kbs_get_notices filter.

All notices are stored as an array within the kbs_get_notices() function. The array key is the ID of the notice and it is necessary for you to know the ID in order to adjust a specific notice.

The array values are nested inside further array associated with the ID;

  • class – This is the CSS class applied to the notice. Default styling allows for three values;

    Example notice with success class

    Example notice with error class

    Example notice with info class

  • notice – Defines the text that is displayed as the notice

An example of this array is as follows;

array(
    'need_login' => array(
        'class'  => 'info',
        'notice' => sprintf( __( 'You must be logged in to create a support %s.', 'kb-support' ), kbs_get_ticket_label_singular( true ) )
    )
);

As already mentioned, it is possible to change the values within this array in order to display custom messages to your customers. In the below example, we will change the need_login notice and customise the text.

Example

function kbs_custom_frontend_notice( $notices ) {
    $notices['need_login'] = array(
        'class'  => 'info', // Maintain blue container and text
        'notice' => __( 'Sorry but you need to be logged in to create a new support case.', 'kb-support' )
    );

    return $notices;
}
add_filter( 'kbs_get_notices', 'kbs_custom_frontend_notice' );

 


Was this article helpful?

We're working hard to ensure we provide you with useful and relevant documentation to help you get the most out of KB Support.

Please take a moment to let us know if you found this article helpful.

Share this:

  • Tweet
  • WhatsApp

Related Articles

Advanced FAQs Hooks Customisation Last updated: 20th November 2017

Published by Michael

Mike is the founder and lead developer of KB Support. When he's not working on KB Support, he's generally spending time with his 3 children and following his favourite football team

Posts by Michael Visit Website

Post navigation

Previous

Allow Agents to Add and Edit Customers

Next

Email Support Email Commands

Article Categories

  • Configuration
    • Advanced
    • Getting Started
  • Developer Docs
    • Constants
    • Hooks
  • Extensions
  • FAQs

Social Links

  • Follow us on Twitter
  • Like us on Facebook
  • Fork us on GitHub

Resources

  • Contact Us
  • KB Support Discount Code
  • KB Support Demo Site
  • Easy Plugin Demo

Sign up to our newsletter!

Subscribe now to receive all the latest news, thoughts and offers from KB Support.
New subscribers will receive 15% off their first purchase.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
© 2021 KB Support. All rights reserved.
  • Blog
  • Shop
  • Support
  • Demo
  • Privacy Policy
  • Discount Code