Skip to content

Instantly share code, notes, and snippets.

@ihslimn
Last active November 11, 2022 06:31
Show Gist options
  • Save ihslimn/f596c7236b4d2642823a30acc5e4df1c to your computer and use it in GitHub Desktop.
Save ihslimn/f596c7236b4d2642823a30acc5e4df1c to your computer and use it in GitHub Desktop.
JetElements Allow set ID for slider
<?php
/**
* Slider start template
*/
$settings = $this->get_settings_for_display();
$class_array[] = 'jet-slider__items';
$class_array[] = 'sp-slides';
$classes = implode( ' ', $class_array );
$widget_classes = $settings['_css_classes'];
$add_id = ( false !== strpos( $widget_classes, 'slider-id-is-' ) );
$id = '';
if ( $add_id ) {
$widget_classes = explode( ' ', $widget_classes );
foreach ( $widget_classes as $class ) {
if ( false !== strpos( $class, 'slider-id-is-' ) ) {
$id = 'id="' . explode( 'slider-id-is-', $class )[1] . '"';
break;
}
}
}
?>
<div <?php echo $id; ?> class="slider-pro"><?php
echo sprintf( '<div class="jet-slider__arrow-icon-%s hidden-html">%s</div>', $this->get_id(), $this->_render_icon( 'slider_navigation_icon_arrow', '%s', '', false ) );
echo sprintf( '<div class="jet-slider__fullscreen-icon-%s hidden-html">%s</div>', $this->get_id(), $this->_render_icon( 'slider_fullscreen_icon', '%s', '', false ) );
?><div class="<?php echo $classes; ?>">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment