-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive-podcast.php
72 lines (61 loc) · 1.92 KB
/
archive-podcast.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
<?php get_header(); ?>
<div class="wt_archive-podcast">
<div class="wt_archive-videos__intro">
<div class="wt_page-intro wt_page-intro--short">
<h1>Speaking of Us</h1>
</div>
</div>
<?php
// video query args
$args = array(
'post_type' => 'podcast',
'posts_per_page' => '10'//,
// 'meta_key' => 'youtube_publish_date',
// 'orderby' => 'meta_value_num',
// 'order' => 'DESC'
);
$args['meta_query'] = $meta_query;
// Get current page and append to custom query parameters array
$args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$podcast = new WP_Query( $args );
$temp_query = $wp_query;
$wp_query = NULL;
$wp_query = $podcast;
// Run podcast loop
if ( $podcast->have_posts() ) { ?>
<div class="wt_archive-podcast__grid"><!-- podcast thumbnails grid -->
<?php
while ( $podcast->have_posts() ) { $podcast->the_post();
$podcast_title = get_the_title($post);
$podcast_permalink = get_the_permalink();
$podcast_thumbnail = get_the_post_thumbnail();
$podcast_date = get_the_date(); ?>
<div class="wt_archive-podcast__episode"><?php
if ( $podcast_thumbnail ): ?>
<aside class="wt_archive-podcast__thumbnail">
<a href="<?php echo $podcast_permalink; ?>">
<?php echo $podcast_thumbnail; ?>
</a>
</aside>
<?php endif; ?>
<div class="wt_archive-podcast__meta">
<h2 class="wt_archive-podcast__title">
<a href="<?php echo $podcast_permalink; ?>">
<?php echo $podcast_title; ?>
</a>
</h2>
<p class="wt_archive-podcast__date">From <?php echo $podcast_date; ?></p>
</div>
</div><?php
}
} wp_reset_postdata();
// Custom query loop pagination
get_template_part('components/pagination');
// Reset main query object
$wp_query = NULL;
$wp_query = $temp_query;
// Reset post data after query reset to reactive page variables below
wp_reset_postdata(); ?>
</div><!-- /video thumbnails grid -->
</div>
<?php get_footer(); ?>