-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
324 lines (301 loc) · 11 KB
/
index.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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package Cardume
* @subpackage Humus
*/
get_header(); ?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<div id="full-height-content">
<div class="scroll-tip">
<div class="container">
<div class="twelve columns">
<p><span><?php _e('Click to explore our content', 'humus'); ?></span><span class="button-container"><img src="<?php echo get_template_directory_uri(); ?>/img/scroll-down.png" /></span></p>
</div>
</div>
</div>
<div class="full-height-sections">
<div class="items">
<section id="axes-area" class="full-height-section">
<div class="axes-bg">
<div class="odd bg"></div>
<div class="even bg"></div>
</div>
<div class="axes-content">
<div class="gradient-bg"></div>
<div class="container">
<?php
$axes = get_terms('axis', array('hide_empty' => 0));
foreach($axes as $axis) :
$axis_posts = get_posts(array(
'posts_per_page' => 4,
'post_type' => get_post_types(array('public' => true)),
'axis' => $axis->slug,
'meta_query' => array(
array(
'key' => 'home_featured',
'value' => 1
),
array(
'key' => 'home_featured_axis',
'value' => $axis->term_id
)
),
'orderby' => 'rand'
));
?>
<div class="four columns relative">
<div class="axis-content <?php echo $axis->slug; ?>" data-axis="<?php echo $axis->slug; ?>">
<h2><a href="<?php echo get_term_link($axis); ?>"><?php echo $axis->name; ?></a></h2>
<?php
if($axis_posts) :
?>
<ul class="axis-posts">
<?php
foreach($axis_posts as $post) :
global $post;
setup_postdata($post);
$title = get_field('home_featured_title') ? get_field('home_featured_title') : get_the_title();
$description = get_field('home_featured_description') ? get_field('home_featured_description') : get_the_excerpt();
$image = get_field('home_featured_image');
?>
<li data-postid="<?php echo $post->ID; ?>" data-image="<?php echo $image; ?>" data-axis="<?php echo $axis->slug; ?>" class="axis-post">
<img src="<?php echo humus_get_term_icon_url($post->ID, 'section'); ?>" class="section-icon" />
<h3><a href="<?php the_permalink(); ?>"><?php echo $title; ?></a></h3>
<p><a href="<?php the_permalink(); ?>"><?php echo $description; ?></a></p>
<a class="area-link" href="<?php the_permalink(); ?>" title="<?php echo $title; ?>"></a>
</li>
<?php
wp_reset_postdata();
endforeach;
?>
</ul>
<?php
endif;
?>
</div>
<div class="clearfix"> </div>
</div>
<?php
endforeach;
?>
</div>
</div>
<div class="prev axes-nav"></div>
<div class="next axes-nav"></div>
</section>
<?php /* <section id="magazine-area" class="full-height-section" style="background-image: url(http://lorempixum.com/900/600/);"></section> */ ?>
<section id="sections-area" class="full-height-section">
<?php
$sections = get_terms('section', array('hide_empty' => 0));
shuffle($sections);
$section_posts = array();
foreach($sections as $section) {
$section_post = get_posts(array(
'posts_per_page' => 1,
'post_type' => get_post_types(array('public' => true)),
'section' => $section->slug,
'meta_query' => array(
array(
'key' => 'section_featured',
'value' => 1
)
)
));
if($section_post) {
$section_posts[$section->slug] = array_shift($section_post);
}
}
?>
<div class="sections-content <?php if(empty($section_posts)) echo 'vertical-center'; ?>">
<div class="container">
<div class="six columns">
<ul class="section-list">
<?php foreach($sections as $section) : ?>
<li data-termid="<?php echo $section->term_id; ?>">
<h2>
<a href="<?php echo get_term_link($section); ?>">
<img src="<?php echo humus_get_term_icon_url('section_' . $section->term_id); ?>" />
<?php echo $section->name; ?>
</a>
</h2>
</li>
<?php endforeach; ?>
</ul>
</div>
<div class="six columns">
<ul class="section-descriptions">
<?php foreach($sections as $section) : ?>
<li data-termid="<?php echo $section->term_id; ?>" class="clearfix">
<?php if($section->description) : ?>
<p class="description"><a href="<?php echo get_term_link($section); ?>"><?php echo $section->description; ?></a></p>
<?php endif; ?>
<p class="link"><a href="<?php echo get_term_link($section); ?>"><?php _e('View all content from this section', 'humus'); ?></a></p>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<?php
if(!empty($section_posts)) :
global $post;
?>
<ul class="section-posts">
<?php
foreach($sections as $section) :
if(!isset($section_posts[$section->slug]))
continue;
$post = $section_posts[$section->slug];
setup_postdata($post);
$title = get_field('section_featured_title') ? get_field('section_featured_title') : get_the_title();
$image = get_field('section_featured_image');
?>
<li data-termid="<?php echo $section->term_id; ?>" data-image="<?php echo $image; ?>">
<div class="post-container">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"></a>
<div class="container">
<div class="twelve columns">
<?php if(!get_field('section_featured_image_only')) : ?>
<div class="post-content <?php echo get_field('section_featured_color'); ?>">
<?php
/*
<?php
$axis = get_the_terms($post->ID, 'axis');
if($axis) :
$axis = array_shift($axis);
?>
<h3><?php echo $axis->name; ?></h3>
<?php endif; ?>
<h2><?php echo $title; ?></h2>
*/
?>
<h2><?php echo $title; ?></h2>
<?php the_excerpt(); ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
</li>
<?php
wp_reset_postdata();
endforeach;
?>
</ul>
<?php endif; ?>
</div>
</section>
<?php
$recent = get_posts(array(
'posts_per_page' => 10
));
if($recent) :
?>
<section id="recent-area" class="full-height-section">
<div class="recent-content vertical-center">
<div class="container">
<div class="twelve columns">
<h2><?php _e('Recent posts', 'humus'); ?></h2>
</div>
<div class="nine columns">
<div class="active clearfix">
<div class="active-container">
</div>
<div class="active-info"></div>
<div class="active-links">
<a href="#" class="read-more"><?php _e('Read more on this content', 'humus'); ?></a>
</div>
</div>
</div>
<div class="three columns">
<div class="item-list">
<ul class="items">
<?php
foreach($recent as $post) :
global $post;
setup_postdata($post);
if(!has_post_thumbnail())
continue;
$section_icon = humus_get_term_icon_url($post->ID, 'section');
?>
<li data-postid="<?php the_ID(); ?>">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if($section_icon) : ?>
<img src="<?php echo $section_icon; ?>" class="section-icon" />
<?php endif; ?>
<div class="post-thumbnail">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('humus-wide-thumbnail', array('class' => 'scale-with-grid')); ?>
</a>
</div>
<header class="post-header">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
</header>
</article>
<script>
<?php
$media = get_post_meta($post->ID, "media_oembed", true);
if(!$media)
$media = '<a href="' . get_permalink() . '">' . get_the_post_thumbnail($post->ID, 'humus-wide-medium') . '</a>';
?>
jQuery(document).ready(function($) {
$('#recent-area li[data-postid="<?php the_ID(); ?>"]')
.data('embed', '<?php echo $media; ?>');
});
</script>
</li>
<?php
wp_reset_postdata();
endforeach;
?>
</ul>
<script>
jQuery(document).ready(function($) {
$('#recent-area').trigger('dataReady');
});
</script>
</div>
<div class="list-controls">
<a href="#" class="prev"></a>
<a href="#" class="next"></a>
</div>
</div>
</div>
</div>
</section>
<?php
endif;
?>
<?php
$ad = humus_get_ad(array('name' => 'Home'));
if($ad) : ?>
<section class="ad-section full-height-section">
<div class="vertical-center">
<?php humus_ad(array('name' => 'Home')); ?>
</div>
</section>
<?php
endif;
?>
<section class="footer-section full-height-section" style="overflow: auto;">
<?php get_template_part('section', 'colophon'); ?>
</section>
</div><!-- .items -->
</div><!-- .full-height-sections -->
</div><!-- #full-height-content -->
</div><!-- #content -->
</div><!-- #primary -->
</div><!-- #main -->
</div><!-- #page -->
<?php wp_footer(); ?>
</body>
</html>