/** * BxSlider * * Displays the slider on template files. * * @param string $slider_slug The slug of the slider. */ function bxslider($slider_slug) { $codefleet_bxslider_data = new BxSliderWp_Data(); $slider_view = new BxSliderWp_View(realpath(plugin_dir_path(__FILE__)) . DIRECTORY_SEPARATOR . 'views'); if (isset($codefleet_bxslider_data)) { echo $codefleet_bxslider_data->get_slider_render($slider_slug, $slider_view); } }
function form($instance) { $instance = wp_parse_args((array) $instance, array('slider' => '')); ?> <p> <?php if ($sliders = BxSliderWp_Data::get_sliders()) { ?> <label for="<?php echo $this->get_field_id('slider'); ?> "><?php _e('Select a slider:', 'bxslider'); ?> </label> <select class="widefat" id="<?php echo $this->get_field_id('slider'); ?> " name="<?php echo $this->get_field_name('slider'); ?> "> <option value=""></option> <?php foreach ($sliders as $slider) { ?> <option value="<?php echo $slider->post_name; ?> " <?php echo $instance['slider'] == $slider->post_name ? 'selected="selected"' : ''; ?> ><?php echo $slider->post_title; ?> </option> <?php } ?> </select> <?php } else { ?> <?php _e('No sliders found.', 'bxslider'); ?> <?php } ?> </p> <?php }