wp_print_admin_notice_templates

Prints the JavaScript templates for update admin notices.

Description

wp_print_admin_notice_templates(); 

Template takes one argument with four values:

Arguments for admin notice.


Usage

  1. if ( !function_exists( 'wp_print_admin_notice_templates' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/update.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_print_admin_notice_templates(); 
  7.  

Defined (1)

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

/wp-admin/includes/update.php  
  1. function wp_print_admin_notice_templates() { 
  2. ?> 
  3. <script id="tmpl-wp-updates-admin-notice" type="text/html"> 
  4. <div <# if ( data.id ) { #>id="{{ data.id }}"<# } #> class="notice {{ data.className }}"><p>{{{ data.message }}}</p></div> 
  5. </script> 
  6. <script id="tmpl-wp-bulk-updates-admin-notice" type="text/html"> 
  7. <div id="{{ data.id }}" class="{{ data.className }} notice <# if ( data.errors ) { #>notice-error<# } else { #>notice-success<# } #>"> 
  8. <p> 
  9. <# if ( data.successes ) { #> 
  10. <# if ( 1 === data.successes ) { #> 
  11. <# if ( 'plugin' === data.type ) { #> 
  12. <?php 
  13. /** translators: %s: Number of plugins */ 
  14. printf( __( '%s plugin successfully updated.' ), '{{ data.successes }}' ); 
  15. ?> 
  16. <# } else { #> 
  17. <?php 
  18. /** translators: %s: Number of themes */ 
  19. printf( __( '%s theme successfully updated.' ), '{{ data.successes }}' ); 
  20. ?> 
  21. <# } #> 
  22. <# } else { #> 
  23. <# if ( 'plugin' === data.type ) { #> 
  24. <?php 
  25. /** translators: %s: Number of plugins */ 
  26. printf( __( '%s plugins successfully updated.' ), '{{ data.successes }}' ); 
  27. ?> 
  28. <# } else { #> 
  29. <?php 
  30. /** translators: %s: Number of themes */ 
  31. printf( __( '%s themes successfully updated.' ), '{{ data.successes }}' ); 
  32. ?> 
  33. <# } #> 
  34. <# } #> 
  35. <# } #> 
  36. <# if ( data.errors ) { #> 
  37. <button class="button-link bulk-action-errors-collapsed" aria-expanded="false"> 
  38. <# if ( 1 === data.errors ) { #> 
  39. <?php 
  40. /** translators: %s: Number of failed updates */ 
  41. printf( __( '%s update failed.' ), '{{ data.errors }}' ); 
  42. ?> 
  43. <# } else { #> 
  44. <?php 
  45. /** translators: %s: Number of failed updates */ 
  46. printf( __( '%s updates failed.' ), '{{ data.errors }}' ); 
  47. ?> 
  48. <# } #> 
  49. <span class="screen-reader-text"><?php _e( 'Show more details' ); ?></span> 
  50. <span class="toggle-indicator" aria-hidden="true"></span> 
  51. </button> 
  52. <# } #> 
  53. </p> 
  54. <# if ( data.errors ) { #> 
  55. <ul class="bulk-action-errors hidden"> 
  56. <# _.each( data.errorMessages, function( errorMessage ) { #> 
  57. <li>{{ errorMessage }}</li> 
  58. <# } ); #> 
  59. </ul> 
  60. <# } #> 
  61. </div> 
  62. </script> 
  63. <?php