-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpage_home.php
223 lines (179 loc) · 8.4 KB
/
page_home.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?php /* Template Name: Index - Home */ ?>
<?php
get_header('', array( 'body-classes' => 'home-narrative') );
?>
<main>
<article class="topic-summary">
<h2>Better Sharing, Brighter Future</h2>
<figure>
<?php
$featured_media_notice = get_field('featured_media_notice');
if ( $featured_media_notice ) :
?>
<span class="attention">
<span class="icon-attach fa-info"></span>
<?php echo $featured_media_notice; ?>
</span>
<?php endif; ?>
<iframe style="width: 100%;" title="Twenty Years of Creative Commons (in Sixty Seconds)" src="https://player.vimeo.com/video/777912896?h=016f97b875&badge=0&autopause=0&player_id=0&app_id=58479" frameborder="0" allowfullscreen="allowfullscreen" data-ready="true"></iframe>
<figcaption class="attribution">
“<a href="https://www.flickr.com/photos/creativecommons/52543574218/">Twenty Years of Creative Commons (in Sixty Seconds)</a>” by <a href="http://www.junell.net/">Ryan Junell</a> and <a href="https://www.linkedin.com/in/gotisbrown/">Glenn Otis Brown</a> for <a href="https://creativecommons.org/">Creative Commons</a> is licensed via <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a> and includes adaptations of the multiple open and public domain works. View full licensing and attribution information about all works included in the video <a href="https://www.flickr.com/photos/creativecommons/52543574218/">on Flickr</a>.
</figcaption>
</figure>
<div class="description">
<p>Creative Commons is an international nonprofit organization that empowers people to grow and sustain the thriving commons of shared knowledge and culture we need to address the world's most pressing challenges and create a brighter future for all.</p>
<a href="/mission">Learn more</a>
</div>
</article>
<article class="case-studies">
<h2>The nonprofit behind the licenses and tools the world uses to share</h2>
<p>For over 20 years, Creative Commons has supported a global movement built on a belief in the power of open access to knowledge and creativity. From Wikipedia to the Smithsonian, organizations and individuals rely on our work to share billions of historic images, scientific articles, cultural artifacts, educational resources, music, and more!</p>
<?php
$case_studies = get_field('case_studies');
if ( $case_studies ) :
?>
<ul>
<?php
foreach ($case_studies as $case_study) :
$case_study_img_url = wp_get_attachment_image_url( $case_study->ID, 'full' );
$case_study_img_id = attachment_url_to_postid( $case_study_img_url );
$case_study_caption = wp_get_attachment_caption($case_study->ID);
$case_study_alt = $image_alt = get_post_meta($case_study_img_id, '_wp_attachment_image_alt', TRUE);
?>
<li>
<figure>
<img src="<?php echo $case_study_img_url; ?>" alt="<?php echo $case_study_alt; ?>" />
<figcaption class="attribution"><?php echo $case_study_caption; ?></figcaption>
</figure>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<footer>
<article class="data-points supporting">
<?php
$firstDataPointImage = get_field('first_data_point_image');
$secondDataPointImage = get_field('second_data_point_image');
$thirdDataPointImage = get_field('third_data_point_image');
?>
<ul>
<li>
<article class="data-point wikipedia">
<h2 style="background-image: url('<?php echo $firstDataPointImage; ?>');">Wikipedia</h2>
<h3 class="stat">55+ million articles</h3>
<p>Every one of Wikipedia's 55 million plus articles are shared openly and freely using a CC license.</p>
</article>
</li>
<li>
<article class="data-point the-met">
<h2 style="background-image: url('<?php echo $secondDataPointImage; ?>');");">The Met</h2>
<h3 class="stat">492,000+ images</h3>
<p>All images of public-domain works in the Met's collection are openly available under Creative Commons Zero (CC0).</p>
</article>
</li>
<li>
<article class="data-point khan-academy">
<h2 style="background-image: url('<?php echo $thirdDataPointImage; ?>');");">Khan Academy</h2>
<h3 class="stat">100,000+ lessons</h3>
<p>Many of the lessons found on Khan Academy are openly licensed under CC-BY-NC-SA.</p>
</article>
</li>
</ul>
</article>
</footer>
</article>
<?php
$blog = get_page_by_path( 'blog' );
if( $blog ) {
$posts = get_field('featured_posts', $blog);
}
if( $posts ):
?>
<article class="posts featured">
<h2>Latest News</h2>
<ul>
<?php
$i=1;
foreach( $posts as $post ):
$permalink = get_permalink( $post->ID );
$title = get_the_title( $post->ID );
//$custom_field = get_field( 'field_name', $post->ID );
?>
<li>
<article class="post">
<header>
<h3 class="title"><a href="<?php echo esc_url( $permalink ); ?>"><?php echo esc_html( $title ); ?></a></h3>
<?php if ( get_field('authorship') ) : ?>
<span class="byline">by
<?php
$authors = get_field('authorship');
if( $authors ):
$ai = 1;
$count = count($authors);
foreach( $authors as $author ):
$permalink = get_permalink( $author->ID );
$title = get_the_title( $author->ID );
$custom_field = get_field( 'field_name', $author->ID );
if ($ai < $count) {
$separator = ',';
}
else {
$separator = '';
}
?>
<a href="<?php echo esc_url( $permalink ); ?>"><?php echo esc_html( $title ); ?></a><?php echo $separator; ?>
<?php $ai++; ?>
<?php endforeach; ?>
<?php endif; ?>
</span>
<?php endif; ?>
<span class="categories">
<?php the_category(', ') ?>
</span>
</header>
<figure>
<?php //echo get_the_post_thumbnail( $post_id, 'full' );
?>
<img src="<?php echo get_the_post_thumbnail_url( $post_id, 'full' ); ?>" alt="<?php echo get_post_meta ( get_post_thumbnail_id($post_id), '_wp_attachment_image_alt', true ); ?>" />
<?php if ($i == 1): ?>
<figcaption class="attribution"><?php echo get_the_post_thumbnail_caption( $post_id ); ?></figcaption>
<?php endif; ?>
</figure>
<?php if ($i == 1): ?>
<?php the_excerpt(); ?>
<?php endif; ?>
</article>
</li>
<?php
if ($i != 1) {
$highlight_posts[] = $post->ID;
}
$i++;
?>
<?php endforeach; ?>
</ul>
<a class="more" href="/blog/archive/">more posts</a>
</article>
<footer>
<article class="attribution-list">
<h2>Images Attri­bution</h2>
<button class="expand-attribution">view</button>
<ul class="attribution-panel">
<?php foreach ($highlight_posts as $item) : ?>
<?php if( get_the_post_thumbnail_caption( $item ) ) : ?>
<li>
<article>
<figure>
<img src="<?php echo get_the_post_thumbnail_url( $item, 'full' ); ?>" alt="<?php echo get_post_meta ( get_post_thumbnail_id($item), '_wp_attachment_image_alt', true ); ?>" />
<figcaption class="attribution"><?php echo get_the_post_thumbnail_caption( $item ); ?></figcaption>
</figure>
</article>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</article>
</footer>
<?php endif; ?>
</main>
<?php get_footer(); ?>