list_theme_updates

The WordPress Core list theme updates function.

Description

list_theme_updates(); 

Usage

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

Defined (1)

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

/wp-admin/update-core.php  
  1. function list_theme_updates() { 
  2. $themes = get_theme_updates(); 
  3. if ( empty( $themes ) ) { 
  4. echo '<h2>' . __( 'Themes' ) . '</h2>'; 
  5. echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>'; 
  6. return; 
  7.  
  8. $form_action = 'update-core.php?action=do-theme-upgrade'; 
  9. ?> 
  10. <h2><?php _e( 'Themes' ); ?></h2> 
  11. <p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click “Update Themes”.' ); ?></p> 
  12. <p><?php printf( __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ), __( 'https://codex.wordpress.org/Child_Themes' ) ); ?></p> 
  13. <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade"> 
  14. <?php wp_nonce_field('upgrade-core'); ?> 
  15. <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p> 
  16. <table class="widefat updates-table" id="update-themes-table"> 
  17. <thead> 
  18. <tr> 
  19. <td class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></td> 
  20. <td class="manage-column"><label for="themes-select-all"><?php _e( 'Select All' ); ?></label></td> 
  21. </tr> 
  22. </thead> 
  23.  
  24. <tbody class="plugins"> 
  25. <?php 
  26. foreach ( $themes as $stylesheet => $theme ) { 
  27. $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) ); 
  28. ?> 
  29. <tr> 
  30. <td class="check-column"> 
  31. <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" /> 
  32. <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php 
  33. /** translators: %s: theme name */ 
  34. printf( __( 'Select %s' ),  
  35. $theme->display( 'Name' ) 
  36. ); 
  37. ?></label> 
  38. </td> 
  39. <td class="plugin-title"><p> 
  40. <img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" /> 
  41. <strong><?php echo $theme->display( 'Name' ); ?></strong> 
  42. <?php 
  43. /** translators: 1: theme version, 2: new version */ 
  44. printf( __( 'You have version %1$s installed. Update to %2$s.' ),  
  45. $theme->display( 'Version' ),  
  46. $theme->update['new_version'] 
  47. ); 
  48. ?> 
  49. </p></td> 
  50. </tr> 
  51. <?php 
  52. ?> 
  53. </tbody> 
  54.  
  55. <tfoot> 
  56. <tr> 
  57. <td class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></td> 
  58. <td class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></td> 
  59. </tr> 
  60. </tfoot> 
  61. </table> 
  62. <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p> 
  63. </form> 
  64. <?php