cptui_admin_notices_helper

Secondary admin notices function for use with admin_notices hook.

Description

(mixed|void) cptui_admin_notices_helper( (string) $message = '', (bool) $success = true ); 

Constructs admin notice HTML.

Returns (mixed|void)

Parameters (2)

0. $message — Optional. (string) => ''
Message to use in admin notice. Optional. Default empty string.
1. $success — Optional. (bool) => true
Whether or not a success. Optional. Default true.

Usage

  1. if ( !function_exists( 'cptui_admin_notices_helper' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'custom-post-type-ui/inc/utility.php'; 
  3.  
  4. // Message to use in admin notice. Optional. Default empty string. 
  5. $message = ''; 
  6.  
  7. // Whether or not a success. Optional. Default true. 
  8. $success = true; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = cptui_admin_notices_helper($message, $success); 
  12.  

Defined (1)

The function is defined in the following location(s).

/inc/utility.php  
  1. function cptui_admin_notices_helper( $message = '', $success = true ) { 
  2.  
  3. $class = array(); 
  4. $class[] = ( $success ) ? 'updated' : error; 
  5. $class[] = 'notice is-dismissible'; 
  6.  
  7. $messagewrapstart = '<div id="message" class="' . implode( ' ', $class ) . '"><p>'; 
  8.  
  9. $messagewrapend = '</p></div>'; 
  10.  
  11. $action = ''; 
  12.  
  13. /** 
  14. * Filters the custom admin notice for CPTUI. 
  15. * @since 1.0.0 
  16. * @param string $value Complete HTML output for notice. 
  17. * @param string $action Action whose message is being generated. 
  18. * @param string $message The message to be displayed. 
  19. * @param string $messagewrapstart Beginning wrap HTML. 
  20. * @param string $messagewrapend Ending wrap HTML. 
  21. */ 
  22. return apply_filters( 'cptui_admin_notice', $messagewrapstart . $message . $messagewrapend, $action, $message, $messagewrapstart, $messagewrapend );