diff --git src/wp-includes/widgets/class-wp-widget-media-gallery.php src/wp-includes/widgets/class-wp-widget-media-gallery.php
index 13ee9c2d6e..ec00022104 100644
|
|
class WP_Widget_Media_Gallery extends WP_Widget_Media { |
169 | 169 | ?> |
170 | 170 | <script type="text/html" id="tmpl-wp-media-widget-gallery-preview"> |
171 | 171 | <# var describedById = 'describedBy-' + String( Math.random() ); #> |
172 | | <# if ( data.ids.length ) { #> |
| 172 | <# |
| 173 | var ids = _.filter( data.ids, function( id ) { |
| 174 | return ( id in data.attachments ); |
| 175 | } ); |
| 176 | #> |
| 177 | <# if ( ids.length ) { #> |
173 | 178 | <div class="gallery media-widget-gallery-preview"> |
174 | | <# _.each( data.ids, function( id, index ) { #> |
175 | | <# |
176 | | var attachment = data.attachments[ id ]; |
177 | | if ( ! attachment ) { |
178 | | return; |
179 | | } |
180 | | #> |
| 179 | <# _.each( ids, function( id, index ) { #> |
| 180 | <# var attachment = data.attachments[ id ]; #> |
181 | 181 | <# if ( index < 6 ) { #> |
182 | 182 | <dl class="gallery-item"> |
183 | 183 | <dt class="gallery-icon"> |
… |
… |
class WP_Widget_Media_Gallery extends WP_Widget_Media { |
186 | 186 | <# } else { #> |
187 | 187 | <img src="{{ attachment.url }}" alt="" /> |
188 | 188 | <# } #> |
189 | | <# if ( index === 5 && data.ids.length > 6 ) { #> |
| 189 | <# if ( index === 5 && ids.length > 6 ) { #> |
190 | 190 | <div class="gallery-icon-placeholder"> |
191 | | <p class="gallery-icon-placeholder-text">+{{ data.ids.length - 5 }}</p> |
| 191 | <p class="gallery-icon-placeholder-text">+{{ ids.length - 5 }}</p> |
192 | 192 | </div> |
193 | 193 | <# } #> |
194 | 194 | </dt> |