-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive-video.php
64 lines (64 loc) · 2.02 KB
/
archive-video.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
<?php get_header(); ?>
<div class="videos block">
<div class="container">
<div class="block-title"> <?php echo __('Видео', 'machete');?> </div>
<div class="text-center">
<ul class="items-filter">
<li><a href="#" data-filter="*" class="active">ВСЕ</a></li>
<?php
/** The taxonomy we want to parse */
$taxonomy = "v_albums";
/** Get all taxonomy terms */
$terms = get_terms($taxonomy, array(
"orderby" => "ASC",
"hide_empty" => false
)
);
/** Loop through every term */
foreach($terms as $term) :
//Skip term if it has children
if($term->parent) {
continue;
} ?>
<li><a href="#" data-filter=".year<?php echo $term->name; ?>"><?php echo $term->name; ?></a></li>
<?php endforeach; ?>
</ul>
</div>
<div class="grid">
<div class="grid-sizer"></div>
<?php
foreach($terms as $term) :
$videos = get_posts(
array(
'posts_per_page' => -1,
'post_type' => 'video',
'tax_query' => array(
array(
'taxonomy' => 'v_albums',
'field' => 'term_id',
'terms' => $term->term_id,
)
)
)
);
foreach ($videos as $video) :
?>
<div class="grid-item year<?php echo $term->name; ?>">
<div class="image">
<a href="<?php echo get_permalink($video->ID); ?>">
<?php
do_action('video_thumbnail', get_field('youtube_video_id', $video->ID), get_the_post_thumbnail_url($video->ID, array(360, 300)));
?>
<span class="caption">
<span class="title"><?php echo $video->post_title; ?></span>
<span class="type">VIDEO</span>
</span>
</a>
</div>
</div>
<?php endforeach; ?>
<?php endforeach; ?>
</div>
</div>
</div>
<?php get_footer(); ?>