Image re-order
-
Is there a way to re-order images without deleting and re-uploading the images?
Thanks
-
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 ?
Gyan, if you can post your solution, it would help anyone else who is looking for this and arrives here when searching.
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.
Thanks Gyan, looks like a good solution.
Really ?? Welcome . 🙂
it would be great if it helps someone.
Great Stuff Gyan! This makes a good plugin a much better one!
Thanks Gyan. 😉
Thanks Rusty ! 🙂
your’e welcome vitamineg. have you tried the solution ?Yes, I just implemented the code Gyan. Brilliant. Thank you kind Sir.
😀
Nice.. Please mark it resolved
::resolved::
Any way that the plug in can be updated to include this code?
That’s the best way I could have helped mate. You need any further assistance you can contact me for custom work here.
The topic ‘Image re-order’ is closed to new replies.