Responsive WordPress Theme – Caliber

A theme with simple controls and limitless potential. Work fast and build an amazing website!   Find out more »

UpThemes – Beautiful WordPress Themes

Create a site your church, gallery, newspaper, blog, recipes, band and more!   See the themes »

Need a little help?  Find answers quickly by searching the forum.
Group Admins
  • andy
  • jeffw

Support for: Razor: Cutting Edge WordPress Theme

Razor

Public Group  |  active 1 year, 9 months ago ago
Viewing post 1 to 4 (4 total posts)

Slideshow random order

  • buddyboy8403

    said

    Website: http://continentalenews.com/

    I’m using the large header slideshow to serve ads. I want the ads to display and rotate in a random order that way all advertisers have equal shot of their ads showing first. Is it possible to have the slide show images display in a random order?

  • jeffw

    said

    Slides will be displayed in the order they appear in the Slides table. There isn’t an option to randomise the order in which slides are displayed.

    The only way I can think of to randomise the order would be to modify the JavaScript in the slideshow code. Open the ‘framework/theme-functions/layout-and-design.php‘ file and on line 885 or thereabouts you’ll see the following block of code…

    // create slide show (or column) JavaScript
    echo '$("#'. $key .'").filter(":first").waitForImages(function() {';  // allow all images to load before starting slide show
      echo '$("#'. $key .'").cycle({ before: beforeSlide, after: afterSlide, fx:"'. $value['fx'] .'",timeout:'. $slideTimeout .',speed:'. $value['speed'] .',pause:'. $value['pause'] . $responsiveCycle .',randomizeEffects:0, pager:"#'. $key .'_nav"});';
    echo '});'

    Change it to this…

    // create slide show (or column) JavaScript
    echo '$("#'. $key .'").filter(":first").waitForImages(function() {';  // allow all images to load before starting slide show
      echo '$("#'. $key .'").cycle({ random: 1, before: beforeSlide, after: afterSlide, fx:"'. $value['fx'] .'",timeout:'. $slideTimeout .',speed:'. $value['speed'] .',pause:'. $value['pause'] . $responsiveCycle .',randomizeEffects:0, pager:"#'. $key .'_nav"});';
    echo '});'

    Save and upload.

    This will apply the random slide effect to all slideshows. To have it just for a particular slideshow you will need to develop some code to test for a specific condition, or add new admin options.

    Always keep in mind that if you modify core theme files then when you need to update the theme your modified files may be overwritten and your modifications lost. The more modifications you make to core theme files, the more difficult it will become for you to update the theme because when you need to update the theme you are going to have to make your modifications again to the updated theme files.

  • buddyboy8403

    said

    Could I create a child theme and put this mod in there, or create a plugin somehow that way when theme upgrades occur I don’t have the mod overwritten?

  • jeffw

    said

    The theme will always look for its framework in the parent theme folder.

Viewing post 1 to 4 (4 total posts)
Topic tags: random order, slide show