Title: Image re-order
Last modified: August 21, 2016

---

# Image re-order

 *  Resolved [vitamineg](https://wordpress.org/support/users/vitamineg/)
 * (@vitamineg)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/image-re-order/)
 * Is there a way to re-order images without deleting and re-uploading the images?
 * Thanks
 * [http://wordpress.org/plugins/wp-cycle/](http://wordpress.org/plugins/wp-cycle/)

Viewing 13 replies - 1 through 13 (of 13 total)

 *  [Gyan Gaurav](https://wordpress.org/support/users/gyan-gaurav/)
 * (@gyan-gaurav)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/image-re-order/#post-4118886)
 * Hi vitamineg !!
 * The wp-cycle plugin does not support this reordering facility.. I just tried 
   what you’re looking for..And i just succeed in it.. all you need to do is to 
   add some codes in your wp-cycle.php file in the plugin directory.
 * I will be happy to assist you.. But let me first know if you have already got
   this issue resolved ?
 *  Moderator [cubecolour](https://wordpress.org/support/users/numeeja/)
 * (@numeeja)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/image-re-order/#post-4118887)
 * Gyan, if you can post your solution, it would help anyone else who is looking
   for this and arrives here when searching.
 *  [Gyan Gaurav](https://wordpress.org/support/users/gyan-gaurav/)
 * (@gyan-gaurav)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/image-re-order/#post-4118897)
 * Ok.. There’s my take on this one.
 * To do so I have added one field namely “order” in the image data..
    find this
   code in wp-cycle.php in the plugin directory..
 *     ```
       $wp_cycle_images[$time] = array(
       		'id' => $time,
       		'file' => $file,
       		'file_url' => $url,
       		'thumbnail' => $thumbnail,
       		'thumbnail_url' => $thumbnail_url,
       		'image_links_to' => ''
       	);
       ```
   
 * and add here another line ‘Order’ => ” so that it become like ..
 *     ```
       $wp_cycle_images[$time] = array(
       		'id' => $time,
       		'file' => $file,
       		'file_url' => $url,
       		'thumbnail' => $thumbnail,
       		'thumbnail_url' => $thumbnail_url,
       		'image_links_to' => '',
       		'Order' => ''
       	);
       ```
   
 *  then we need to make it appear in the admin section .. so find the <thead> and
   <tfoot> section here..
    and in the <tr> section of both of these <thead> and 
   <tfoot> add a line <th scope=”col”>Order</th> this will make it appear in the
   settings page. Just below that </tbody> section you will find a form like <form
   method=”post” action=”options.php”> now in this form add a <td> like
 *     ```
       <td><input type="text" name="wp_cycle_images[<?php echo $image; ?>][order]" value="<?php echo $data['order']; ?>" size="35" /></td>
       ```
   
 * this .
 *  Next we need to store this order value . therefore find a function there function
   wp_cycle_images_validate($input) {
    add this code below the last line of the 
   function.
 * if($value[‘order’])
    $input[$key][‘order’] = wp_filter_nohtml_kses($value[‘order’]);
 * Now finally we need to modify the wp_cycle() function to our needs. So add some
   codes just below this(echo ‘<div id=”‘.$wp_cycle_settings[‘div’].'”>’.$newline;)
   line in wp_cycle($args = array(), $content = null) function.
 *     ```
       $sortArray = array();
       	foreach($wp_cycle_images as $imgs){
           foreach($imgs as $key=>$value){
               if(!isset($sortArray[$key])){
                   $sortArray[$key] = array();
               }
               $sortArray[$key][] = $value;
           }
       	}
       $orderby = "order";
       array_multisort($sortArray[$orderby],SORT_ASC,$wp_cycle_images);
       ```
   
 * thats it. It worked for me. Let me know if it helps. and sorry for my bad English.
 *  Moderator [cubecolour](https://wordpress.org/support/users/numeeja/)
 * (@numeeja)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/image-re-order/#post-4118900)
 * Thanks Gyan, looks like a good solution.
 *  [Gyan Gaurav](https://wordpress.org/support/users/gyan-gaurav/)
 * (@gyan-gaurav)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/image-re-order/#post-4118905)
 * Really ?? Welcome . 🙂
 * it would be great if it helps someone.
 *  [RustyBadRobot](https://wordpress.org/support/users/rustybadrobot/)
 * (@rustybadrobot)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/image-re-order/#post-4119001)
 * Great Stuff Gyan! This makes a good plugin a much better one!
 *  Thread Starter [vitamineg](https://wordpress.org/support/users/vitamineg/)
 * (@vitamineg)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/image-re-order/#post-4119002)
 * Thanks Gyan. 😉
 *  [Gyan Gaurav](https://wordpress.org/support/users/gyan-gaurav/)
 * (@gyan-gaurav)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/image-re-order/#post-4119004)
 * Thanks Rusty ! 🙂
    your’e welcome vitamineg. have you tried the solution ?
 *  Thread Starter [vitamineg](https://wordpress.org/support/users/vitamineg/)
 * (@vitamineg)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/image-re-order/#post-4119016)
 * Yes, I just implemented the code Gyan. Brilliant. Thank you kind Sir.
 * 😀
 *  [Gyan Gaurav](https://wordpress.org/support/users/gyan-gaurav/)
 * (@gyan-gaurav)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/image-re-order/#post-4119017)
 * Nice.. Please mark it resolved
 *  Thread Starter [vitamineg](https://wordpress.org/support/users/vitamineg/)
 * (@vitamineg)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/image-re-order/#post-4119018)
 * ::resolved::
 *  [cdibi](https://wordpress.org/support/users/cdibi/)
 * (@cdibi)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/image-re-order/#post-4119025)
 * Any way that the plug in can be updated to include this code?
 *  [Gyan Gaurav](https://wordpress.org/support/users/gyan-gaurav/)
 * (@gyan-gaurav)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/image-re-order/#post-4119026)
 * That’s the best way I could have helped mate. You need any further assistance
   you can contact me for custom work [here](http://momentum-software.com).

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Image re-order’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-cycle.svg)
 * [WP-Cycle](https://wordpress.org/plugins/wp-cycle/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-cycle/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-cycle/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-cycle/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-cycle/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-cycle/reviews/)

 * 13 replies
 * 5 participants
 * Last reply from: [Gyan Gaurav](https://wordpress.org/support/users/gyan-gaurav/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/image-re-order/#post-4119026)
 * Status: resolved