Posted on 18 November, 2010 By 3 Comments

How to Randomize the Images with the WordPress WP-Cycle Slideshow Plugin

 

Earlier this week I reviewed the WP-Cycle plugin, which is an easy to use image slideshow plugin.

One feature that it doesn’t have is a random display of the images. The images are displayed in the upload order. This isn’t such a big deal, if you know this in advance, but I didn’t know a client wanted them displayed randomly until after I had uploaded 30+ images and I didn’t want to delete them and start over.

If you want the the images displayed randomly, you will need to edit the plugin file.

Here’s what you do.

Locate the following lines in the plugin file. In the current version, it started at line 811.

echo ‘<div id=”‘.$wp_cycle_settings['div'].’”>’.$newline;
foreach((array)$wp_cycle_images as $image => $data) {

In between the two lines add

shuffle($wp_cycle_images);

The code block should now look like the following.

echo ‘<div id=”‘.$wp_cycle_settings['div'].’”>’.$newline;
shuffle($wp_cycle_images);
foreach((array)$wp_cycle_images as $image => $data) {

The images will now be displayed in a random order. Before editing a plugin file, make a backup of it first.

Of course, if you upgrade the plugin, you will lose your customizations.

The WordPress forums are a great source of information for tidbits like this. I found the solution here.

photo credit: Artiii


StudioPress Premium WordPress Themes

Keep Reading:
Posted In : WordPress Plugins | WordPress Tips

Did you enjoy this article? I can assist you with your WordPress or Facebook project. Contact me and I will provide you with an estimate. You can also connect with me on Facebook or follow me on Twitter. If you are looking for Hosting, WordPress Theme, Newsletter or other recommendations, please view my detailed list.




3 Responses to “How to Randomize the Images with the WordPress WP-Cycle Slideshow Plugin”

Leave a Comment
You may use: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .

CommentLuv badge

About

Kim Woodbridge is an accomplished Information and Technical Consultant specializing in the entire implementation of a WordPress based website including installation, theme design, upgrades, unique customizations and ongoing site maintenance.

Recent Comments

    • Property Marbella: Hi Kim, Good article with several good tips, my friend up in Sweden has clothing stores and online sales with little tr...
    • Kim Woodbridge: This post was written 2.5 years ago. At that time people wanted detailed instructions and asked me to write it. And wh...
    • Kim Woodbridge: Pretty much all themes have a page.php file. Are you using a child theme? If so, you will want to look for the page.ph...
    • Mitch: That's why the internet has evolved into a worthless piece of "junk yard". Everybody is repeating the same thing over an...
    • Meredith: This is very straightforward info, and I think it will help, but I have one question. What if I don't have a page.php fi...

Wordpress Services

  • Installation, upgrades and maintenance
  • Conversion of existing html and css templates
  • Theme and plugin recommendations
  • CSS customizations
  • Troubleshooting and tweaks for unique situations
  • Customization for individual blogging goals and needs
  • Training and advice