I have a class which loads the image sliders on some add_action. There is a function/method "render_slider" which renders the sliders on the page based on the slider selected. The theme tries to get the image slider object before the sliders are loaded.
I tried with init,plugins_loaded,to load the slider.
But still I get the error object not found
class Sliders {
public function __construct() {
add_filter( 'add_sliders', array( $this, 'add_sliders' ) );
add_filter('plugins_loaded',array($this,'load_sliders'),10);
}
public function add_sliders($sliders) {
}
public function load_sliders() {
$sliders_to_load = apply_filters( 'add_sliders', array() );
foreach ( $sliders_to_load as $slider )
$this->sliders[ $slider->id ] = $slider;
}
public function render_slider($slider_type = ''){
switch($slider_type){
case 'rotator' : $rotator = $this->sliders[$slider_type];break; //Object Not Found
default: break;
}
}
}
new Sliders
?add_filter('after_setup_theme',array($this,'load_sliders'),10);
add_slider
method actually does...