/** * Output the slider js settings as data-PARAM on slider container. * @param bool $echo */ function the_slider_data($echo = true) { global $fa_slider; $options = fa_get_slider_options($fa_slider->ID); $theme = $options['theme']['active']; // the plugin js options $js_options = $options['js']; $data = array(); foreach ($js_options as $option => $value) { $data[] = 'data-' . $option . '="' . esc_attr($value) . '"'; } $data[] = 'data-width="' . absint($options['layout']['width']) . '"'; $data[] = 'data-height="' . absint($options['layout']['height']) . '"'; $data[] = 'data-height_resize="' . (bool) $options['layout']['height_resize'] . '"'; $data[] = 'data-fullwidth="' . (bool) $options['layout']['full_width'] . '"'; $data[] = 'data-font_size="' . absint($options['layout']['font_size']) . '"'; $data[] = 'data-is_mobile="' . wp_is_mobile() . '"'; // set theme data on slider data attributes $theme_options = get_slider_theme_options(); if ($theme_options) { foreach ($theme_options as $option => $value) { $data[] = 'data-theme_opt_' . $option . '="' . esc_attr((string) $value) . '"'; } } $output = implode(' ', $data); if ($echo) { echo $output; } return $output; }
<?php // get the options implemented by the slider theme $options = get_slider_theme_options(); ?> <div class="<?php the_slider_class('fa_slider_simple'); ?> " style="<?php the_slider_styles(); ?> " id="<?php the_slider_id(); ?> " <?php the_slider_data(); ?> > <?php while (have_slides()) { ?> <div class="fa_slide <?php the_fa_class(); ?> " style="<?php the_slide_styles(); ?> "> <div class="fa_slide_content"> <?php