media_upload_gallery_form

Adds gallery form to upload iframe.

Description

media_upload_gallery_form( (array) $errors ); 

Parameters (1)

0. $errors (array)
The errors.

Usage

  1. if ( !function_exists( 'media_upload_gallery_form' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/media.php'; 
  3.  
  4. // The errors. 
  5. $errors = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = media_upload_gallery_form($errors); 
  9.  

Defined (1)

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

/wp-admin/includes/media.php  
  1. function media_upload_gallery_form($errors) { 
  2. global $redir_tab, $type; 
  3.  
  4. $redir_tab = 'gallery'; 
  5.  
  6. $post_id = intval($_REQUEST['post_id']); 
  7. $form_action_url = admin_url("media-upload.php?type=$type&tab=gallery&post_id=$post_id"); 
  8. /** This filter is documented in wp-admin/includes/media.php */ 
  9. $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); 
  10. $form_class = 'media-upload-form validate'; 
  11.  
  12. if ( get_user_setting('uploader') ) 
  13. $form_class .= ' html-uploader'; 
  14. ?> 
  15.  
  16. <script type="text/javascript"> 
  17. jQuery(function($) { 
  18. var preloaded = $(".media-item.preloaded"); 
  19. if ( preloaded.length > 0 ) { 
  20. preloaded.each(function() {prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')}, '');}); 
  21. updateMediaForm(); 
  22. }); 
  23. </script> 
  24. <div id="sort-buttons" class="hide-if-no-js"> 
  25. <span> 
  26. <?php _e('All Tabs:'); ?> 
  27. <a href="#" id="showall"><?php _e('Show'); ?></a> 
  28. <a href="#" id="hideall" style="display:none;"><?php _e('Hide'); ?></a> 
  29. </span> 
  30. <?php _e('Sort Order:'); ?> 
  31. <a href="#" id="asc"><?php _e('Ascending'); ?></a> | 
  32. <a href="#" id="desc"><?php _e('Descending'); ?></a> | 
  33. <a href="#" id="clear"><?php _ex('Clear', 'verb'); ?></a> 
  34. </div> 
  35. <form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="gallery-form"> 
  36. <?php wp_nonce_field('media-form'); ?> 
  37. <?php //media_upload_form( $errors ); ?> 
  38. <table class="widefat"> 
  39. <thead><tr> 
  40. <th><?php _e('Media'); ?></th> 
  41. <th class="order-head"><?php _e('Order'); ?></th> 
  42. <th class="actions-head"><?php _e('Actions'); ?></th> 
  43. </tr></thead> 
  44. </table> 
  45. <div id="media-items"> 
  46. <?php echo get_media_items($post_id, $errors); ?> 
  47. </div> 
  48.  
  49. <p class="ml-submit"> 
  50. <?php submit_button( __( 'Save all changes' ), 'savebutton', 'save', false, array( 'id' => 'save-all', 'style' => 'display: none;' ) ); ?> 
  51. <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> 
  52. <input type="hidden" name="type" value="<?php echo esc_attr( $GLOBALS['type'] ); ?>" /> 
  53. <input type="hidden" name="tab" value="<?php echo esc_attr( $GLOBALS['tab'] ); ?>" /> 
  54. </p> 
  55.  
  56. <div id="gallery-settings" style="display:none;"> 
  57. <div class="title"><?php _e('Gallery Settings'); ?></div> 
  58. <table id="basic" class="describe"><tbody> 
  59. <tr> 
  60. <th scope="row" class="label"> 
  61. <label> 
  62. <span class="alignleft"><?php _e('Link thumbnails to:'); ?></span> 
  63. </label> 
  64. </th> 
  65. <td class="field"> 
  66. <input type="radio" name="linkto" id="linkto-file" value="file" /> 
  67. <label for="linkto-file" class="radio"><?php _e('Image File'); ?></label> 
  68.  
  69. <input type="radio" checked="checked" name="linkto" id="linkto-post" value="post" /> 
  70. <label for="linkto-post" class="radio"><?php _e('Attachment Page'); ?></label> 
  71. </td> 
  72. </tr> 
  73.  
  74. <tr> 
  75. <th scope="row" class="label"> 
  76. <label> 
  77. <span class="alignleft"><?php _e('Order images by:'); ?></span> 
  78. </label> 
  79. </th> 
  80. <td class="field"> 
  81. <select id="orderby" name="orderby"> 
  82. <option value="menu_order" selected="selected"><?php _e('Menu order'); ?></option> 
  83. <option value="title"><?php _e('Title'); ?></option> 
  84. <option value="post_date"><?php _e('Date/Time'); ?></option> 
  85. <option value="rand"><?php _e('Random'); ?></option> 
  86. </select> 
  87. </td> 
  88. </tr> 
  89.  
  90. <tr> 
  91. <th scope="row" class="label"> 
  92. <label> 
  93. <span class="alignleft"><?php _e('Order:'); ?></span> 
  94. </label> 
  95. </th> 
  96. <td class="field"> 
  97. <input type="radio" checked="checked" name="order" id="order-asc" value="asc" /> 
  98. <label for="order-asc" class="radio"><?php _e('Ascending'); ?></label> 
  99.  
  100. <input type="radio" name="order" id="order-desc" value="desc" /> 
  101. <label for="order-desc" class="radio"><?php _e('Descending'); ?></label> 
  102. </td> 
  103. </tr> 
  104.  
  105. <tr> 
  106. <th scope="row" class="label"> 
  107. <label> 
  108. <span class="alignleft"><?php _e('Gallery columns:'); ?></span> 
  109. </label> 
  110. </th> 
  111. <td class="field"> 
  112. <select id="columns" name="columns"> 
  113. <option value="1">1</option> 
  114. <option value="2">2</option> 
  115. <option value="3" selected="selected">3</option> 
  116. <option value="4">4</option> 
  117. <option value="5">5</option> 
  118. <option value="6">6</option> 
  119. <option value="7">7</option> 
  120. <option value="8">8</option> 
  121. <option value="9">9</option> 
  122. </select> 
  123. </td> 
  124. </tr> 
  125. </tbody></table> 
  126.  
  127. <p class="ml-submit"> 
  128. <input type="button" class="button" style="display:none;" onMouseDown="wpgallery.update();" name="insert-gallery" id="insert-gallery" value="<?php esc_attr_e( 'Insert gallery' ); ?>" /> 
  129. <input type="button" class="button" style="display:none;" onMouseDown="wpgallery.update();" name="update-gallery" id="update-gallery" value="<?php esc_attr_e( 'Update gallery settings' ); ?>" /> 
  130. </p> 
  131. </div> 
  132. </form> 
  133. <?php