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.