-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeatured.php
More file actions
executable file
·39 lines (36 loc) · 1.21 KB
/
featured.php
File metadata and controls
executable file
·39 lines (36 loc) · 1.21 KB
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
<?php
if ( of_get_option( 'home_slides', true ) and $paged <= 0 ) :
$the_query = new WP_Query(array(
'category_name' => of_get_option('home_slides_category', '') ,
'posts_per_page' => 5,
'offset' => 0
));
$count = 1;
if ( $the_query->have_posts() ) :
?>
<div id="featured-wrapper">
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<?php
while ( $the_query->have_posts() ) : $the_query->the_post();
if ( has_post_thumbnail() ) { // the current post has a thumbnail
?>
<div class="item <?php if( $count == "1" ) echo 'active'; ?>">
<a href="<?php the_permalink();?>"><?php the_post_thumbnail( 'slides' );?></a>
<div class="carousel-caption">
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
</div>
</div>
<?php
}
$count++;
endwhile;
wp_reset_postdata();
?>
</div><!-- carousel-inner -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">›</a>
</div><!-- #myCarousel -->
</div>
<?php endif; ?>
<?php endif; ?>