wp_print_revision_templates

Print JavaScript templates required for the revisions experience.

Description

wp_print_revision_templates(); 

Usage

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

Defined (1)

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

/wp-admin/includes/revision.php  
  1. function wp_print_revision_templates() { 
  2. global $post; 
  3. ?><script id="tmpl-revisions-frame" type="text/html"> 
  4. <div class="revisions-control-frame"></div> 
  5. <div class="revisions-diff-frame"></div> 
  6. </script> 
  7.  
  8. <script id="tmpl-revisions-buttons" type="text/html"> 
  9. <div class="revisions-previous"> 
  10. <input class="button" type="button" value="<?php echo esc_attr_x( 'Previous', 'Button label for a previous revision' ); ?>" /> 
  11. </div> 
  12.  
  13. <div class="revisions-next"> 
  14. <input class="button" type="button" value="<?php echo esc_attr_x( 'Next', 'Button label for a next revision' ); ?>" /> 
  15. </div> 
  16. </script> 
  17.  
  18. <script id="tmpl-revisions-checkbox" type="text/html"> 
  19. <div class="revision-toggle-compare-mode"> 
  20. <label> 
  21. <input type="checkbox" class="compare-two-revisions" 
  22. <# 
  23. if ( 'undefined' !== typeof data && data.model.attributes.compareTwoMode ) { 
  24. #> checked="checked"<# 
  25. #> 
  26. /> 
  27. <?php esc_html_e( 'Compare any two revisions' ); ?> 
  28. </label> 
  29. </div> 
  30. </script> 
  31.  
  32. <script id="tmpl-revisions-meta" type="text/html"> 
  33. <# if ( ! _.isUndefined( data.attributes ) ) { #> 
  34. <div class="diff-title"> 
  35. <# if ( 'from' === data.type ) { #> 
  36. <strong><?php _ex( 'From:', 'Followed by post revision info' ); ?></strong> 
  37. <# } else if ( 'to' === data.type ) { #> 
  38. <strong><?php _ex( 'To:', 'Followed by post revision info' ); ?></strong> 
  39. <# } #> 
  40. <div class="author-card<# if ( data.attributes.autosave ) { #> autosave<# } #>"> 
  41. {{{ data.attributes.author.avatar }}} 
  42. <div class="author-info"> 
  43. <# if ( data.attributes.autosave ) { #> 
  44. <span class="byline"><?php printf( __( 'Autosave by %s' ),  
  45. '<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span> 
  46. <# } else if ( data.attributes.current ) { #> 
  47. <span class="byline"><?php printf( __( 'Current Revision by %s' ),  
  48. '<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span> 
  49. <# } else { #> 
  50. <span class="byline"><?php printf( __( 'Revision by %s' ),  
  51. '<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span> 
  52. <# } #> 
  53. <span class="time-ago">{{ data.attributes.timeAgo }}</span> 
  54. <span class="date">({{ data.attributes.dateShort }})</span> 
  55. </div> 
  56. <# if ( 'to' === data.type && data.attributes.restoreUrl ) { #> 
  57. <input <?php if ( wp_check_post_lock( $post->ID ) ) { ?> 
  58. disabled="disabled" 
  59. <?php } else { ?> 
  60. <# if ( data.attributes.current ) { #> 
  61. disabled="disabled" 
  62. <# } #> 
  63. <?php } ?> 
  64. <# if ( data.attributes.autosave ) { #> 
  65. type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Autosave' ); ?>" /> 
  66. <# } else { #> 
  67. type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Revision' ); ?>" /> 
  68. <# } #> 
  69. <# } #> 
  70. </div> 
  71. <# if ( 'tooltip' === data.type ) { #> 
  72. <div class="revisions-tooltip-arrow"><span></span></div> 
  73. <# } #> 
  74. <# } #> 
  75. </script> 
  76.  
  77. <script id="tmpl-revisions-diff" type="text/html"> 
  78. <div class="loading-indicator"><span class="spinner"></span></div> 
  79. <div class="diff-error"><?php _e( 'Sorry, something went wrong. The requested comparison could not be loaded.' ); ?></div> 
  80. <div class="diff"> 
  81. <# _.each( data.fields, function( field ) { #> 
  82. <h3>{{ field.name }}</h3> 
  83. {{{ field.diff }}} 
  84. <# }); #> 
  85. </div> 
  86. </script><?php