Add random and reverse sorting options to gallery settings.

Props koopersmith
fixes #22637


git-svn-id: http://core.svn.wordpress.org/trunk@22987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren
2012-12-03 05:32:25 +00:00
parent 105cf57225
commit 23ed804180
5 changed files with 74 additions and 40 deletions

View File

@@ -670,8 +670,9 @@ function gallery_shortcode($attr) {
$instance++;
if ( ! empty( $attr['ids'] ) ) {
// 'ids' is explicitly ordered
$attr['orderby'] = 'post__in';
// 'ids' is explicitly ordered, unless you specify otherwise.
if ( empty( $attr['orderby'] ) )
$attr['orderby'] = 'post__in';
$attr['include'] = $attr['ids'];
}
@@ -1489,6 +1490,7 @@ function wp_enqueue_media( $args = array() ) {
'updateGallery' => __( 'Update gallery' ),
'continueEditing' => __( 'Continue editing' ),
'addToGallery' => __( 'Add to gallery' ),
'reverseOrder' => __( 'Reverse order' ),
);
$settings = apply_filters( 'media_view_settings', $settings, $post );
@@ -1865,6 +1867,11 @@ function wp_print_media_templates() {
<?php endfor; ?>
</select>
</label>
<label class="setting">
<span><?php _e('Random'); ?></span>
<input type="checkbox" data-setting="_orderbyRandom" />
</label>
</script>
<script type="text/html" id="tmpl-embed-link-settings">