-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle-story.php
executable file
·159 lines (148 loc) · 4.39 KB
/
single-story.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php get_header(); ?>
<?php the_post();?>
<?php $communityLinkHTML = '';?>
<?php $posts = get_field('community');?>
<?php if($posts) { ?>
<?php foreach($posts as $post){ ?>
<?php setup_postdata($post);?>
<?php $communityLinkHTML .= '<a href="';?>
<?php $communityLinkHTML .= get_the_permalink($post->ID);?>
<?php $communityLinkHTML .= '">';?>
<?php $communityLinkHTML .= get_the_title($post->ID);?>
<?php $communityLinkHTML .= '</a>';?>
<?php } ?>
<?php } ?>
<?php wp_reset_postdata();?>
<div class="container">
<div class="row">
<div class="col">
<div class="title-block">
<p>
<small>
<a href="/">Home</a> / <?php echo $communityLinkHTML;?> / <strong><?php the_title(); ?></strong>
</small>
</p>
<h1 class="text-center">
<?php the_title(); ?>
</h1>
<?php $story_date = get_field('date');?>
<?php if($story_date) { ?>
<p>
<em><?php echo $story_date;?></em>
</p>
<?php } ?>
<?php if(have_rows('contributors')) { ?>
<ul class="story-contributor-list list-unstyled text-center">
<?php while(have_rows('contributors')) { ?>
<li>
<?php the_row();?>
<?php echo get_sub_field('contributor_name');?>
</li>
<?php } ?>
</ul>
<?php } ?>
</div>
<div class="content-block mb-4">
<?php the_content();?>
</div>
</div>
</div>
</div>
<div class="container mb-4">
<div class="row">
<div class="col">
<div class="story-information-module">
<h4>Minority Group</h4>
<p><?php the_field('minority_group');?></p>
<h4>Address</h4>
<?php
$street = get_field('street_address');
$city = get_field('city');
$zip = get_field('zip');
?>
<p>
<?php if($street) {
echo $street . ', ';
} ?>
<?php if($city) {
echo $city . ', ';
} ?>
<?php if($zip) { echo $zip; } ?>
</p>
<?php $terms = wp_get_post_terms($post->ID);?>
<?php if ($terms) { ?>
<h4>Categories</h4>
<ul class="category-list">
<?php foreach ($terms as $term) { ?>
<li><?php echo $term;?></li>
<?php } ?>
</ul>
<?php } ?>
</div>
</div>
</div>
</div>
<?php $images = get_field('image_gallery');?>
<?php if($images) { ?>
<div class="container">
<div class="row">
<div class="col">
<h2 class="text-center">Gallery</h2>
<hr />
</div>
</div>
<div class="grid mb-4">
<div class="grid-sizer"></div>
<div class="gutter-sizer"></div>
<?php foreach( $images as $image ){ ?>
<div class="grid-item">
<img class="img-fluid"
src="<?php echo esc_url($image['sizes']['large']); ?>"
alt="<?php echo esc_attr($image['alt']); ?>"
/>
</div>
<?php } ?>
</div>
</div>
<?php } ?>
<?php $posts = get_field('community');?>
<?php if($posts) { ?>
<div class="container mb-4">
<div class="row">
<div class="col">
<div class="community-module">
<h2 class="text-center">About the Community</h2>
<hr />
<?php foreach($posts as $post){ ?>
<?php setup_postdata($post);?>
<article>
<div class="row">
<?php $image = get_field('image', $post->ID);?>
<?php if(!empty($image)){ ?>
<div class="col-md">
<a href="<?php echo get_permalink($post->ID);?>">
<img class="img-fluid mb-4" src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
</a>
</div>
<?php } ?>
<div class="col-md">
<h3>
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
</h3>
<div class="excerpt">
<?php the_excerpt();?>
</div>
</div>
</div>
</article>
<?php break;?>
<?php } ?>
<?php wp_reset_postdata();?>
</div>
</div>
</div>
</div>
<?php } ?>
<?php get_footer();?>