Developer Guide: Get all Slider Alias

Alternative to the depricated method "getAllSliderAliases"

Before Slider Revolution V6 you as a theme author could get a list of available Slider aliases with something similar to the following code:

// NOT WORKING ANYMORE
$slider = new RevSlider();
$arrSliders = $slider->getAllSliderAliases();

From Slider Revolution V6 the method “getAllSliderAliases” is not available anymore. It is replaced by a more general one called “get_sliders”. It will return an object with multiple informations about the sliders. You can call it like this:

// NEW FUNCTION
$slider = new RevSlider();
$objSliders = $slider->get_sliders();

See everything the method returns with a simple:

// PRINT ALL SLIDER OBJECTS
var_dump($objSliders);

Here is an example of how to walk through the entries to fill the options of a selectbox with aliases and titles:

// CREATE OPTIONS FOR SLIDER SELECTBOX
foreach( $objSliders as $slider ){ ?>
   <option value="<?php echo $slider->alias; ?>"    
   <?php if( isset( $params['alias'] ) ) selected(  $params['alias'], $slider->alias, true )?>>
      <?php echo $slider->title; ?>
   </option> 
<?php }
Developer Guide: Get all Slider Alias

The Author

KC

Strength does not come from winning. Your struggles develop your strengths. When you go through hardships and decide not to surrender, that is strength.

If you need help with anything related to our plugin, please comment on a post or email me at [email protected].

Liked this Post?
Please Share it!