-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathsidebar-slider.php
65 lines (37 loc) · 1.32 KB
/
sidebar-slider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* Index slider
*
*/
$count = count_widgets( 'index-slider' ) ?: 0;
?>
<?php if ( is_active_sidebar( 'index-slider' ) && $count > 0 ) : ?>
<div class="wrapper py-0">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<?php if ( $count > 1 ) : ?>
<ol class="carousel-indicators">
<?php for ( $i = 0; $i < $count; $i ++ ) : ?>
<li data-target="#carouselExampleIndicators" data-slide-to="<?php echo $i ?>"
<?php if ( $i === 0 ): ?>class="active" <?php endif; ?>></li>
<?php endfor; ?>
</ol>
<?php endif; ?>
<div class="carousel-inner" role="listbox">
<?php dynamic_sidebar( 'index-slider' ); ?>
</div>
<?php if ( $count > 1 ) : ?>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
<?php endif; ?>
</div><!-- .carousel -->
<script>
jQuery(".carousel-item").first().addClass("active");
</script>
</div>
<?php endif; ?>