-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule-awards.php
More file actions
54 lines (51 loc) · 1.91 KB
/
module-awards.php
File metadata and controls
54 lines (51 loc) · 1.91 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/*
Awards Module
*/
?>
<aside id="awards-module" class="widget widget-awards bg-84">
<?php
$award_years = get_terms( array( 'taxonomy' => 'award-years', 'orderby' => 'name', 'order' => 'DESC' ) );
$recent_year = $award_years[0]->slug;
$galas = new WP_Query(array('post_type'=>'galas', 'award-years'=> $recent_year ));
while ($galas->have_posts()) : $galas->the_post(); ?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php if (get_field('gala_sponsor') ) : ?>
<div class="award-sponsor">
<h6>Presented by</h6>
<img src="<?php the_field('gala_sponsor'); ?>" alt="Gala Sponsor" />
</div>
<?php endif; ?>
<div class="entry-media">
<?php
$slides = get_field('gala_slideshow'); $count = count($slides);
if ($count > 0) { $img_one = $slides[0]; }
if ($count > 1) { $img_two = $slides[1]; }
if ($count > 2) { $img_three = $slides[2]; }
?>
<ul class="gala-images clear">
<?php if ($count > 0) {
$img_one_object = $img_one['gala_image'];
$img_one_url = $img_one_object['url'];
$img_one_alt = $img_one_object['alt'];
?>
<li><a href="<?php the_permalink(); ?>"><img src="<?php echo($img_one_url); ?>" alt="<?php echo($img_one_alt); ?>" /></a></li>
<?php } ?>
<?php if ($count > 1) {
$img_two_object = $img_two['gala_image'];
$img_two_url = $img_two_object['url'];
$img_two_alt = $img_two_object['alt'];
?>
<li><a href="<?php the_permalink(); ?>"><img src="<?php echo($img_two_url); ?>" alt="<?php echo($img_two_alt); ?>" /></a></li>
<?php } ?>
<?php if ($count > 2) {
$img_three_object = $img_three['gala_image'];
$img_three_url = $img_three_object['url'];
$img_three_alt = $img_three_object['alt'];
?>
<li><a href="<?php the_permalink(); ?>"><img src="<?php echo($img_three_url); ?>" alt="<?php echo($img_three_alt); ?>" /></a></li>
<?php } ?>
</ul>
</div>
<?php endwhile; ?>
</aside>