Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #123 from meydjer/master

Change $meta order using the posts 'menu_order'
  • Loading branch information...
commit 75635b08f91d441d61123048f1646f81b5d3e9cd 2 parents 0eeca2a + cbc8810
@rilwis authored
Showing with 18 additions and 0 deletions.
  1. +9 −0 inc/fields/image.php
  2. +9 −0 inc/fields/plupload-image.php
View
9 inc/fields/image.php
@@ -105,6 +105,15 @@ static function html( $html, $meta, $field )
$html .= "<h4>{$i18n_msg}</h4>";
$html .= "<ul class='rwmb-images rwmb-uploaded'>";
+ // Change $meta order using the posts 'menu_order'
+ $meta_menu_order = array();
+ foreach ($meta as $post_id) {
+ $post_meta = get_post($post_id);
+ $meta_menu_order[$post_meta->menu_order] = $post_id;
+ }
+ ksort($meta_menu_order);
+ $meta = $meta_menu_order;
+
foreach ( $meta as $image )
{
$src = wp_get_attachment_image_src( $image, 'thumbnail' );
View
9 inc/fields/plupload-image.php
@@ -142,6 +142,15 @@ static function html( $html, $meta, $field )
if ( ! is_array( $meta ) )
$meta = ( array ) $meta;
+ // Change $meta order using the posts 'menu_order'
+ $meta_menu_order = array();
+ foreach ($meta as $post_id) {
+ $post_meta = get_post($post_id);
+ $meta_menu_order[$post_meta->menu_order] = $post_id;
+ }
+ ksort($meta_menu_order);
+ $meta = $meta_menu_order;
+
$i18n_msg = _x( 'Uploaded files', 'image upload', 'rwmb' );
$i18n_title = _x( 'Upload files', 'image upload', 'rwmb' );
Please sign in to comment.
Something went wrong with that request. Please try again.