Make WordPress Core

Ticket #55638: single-programme.php

File single-programme.php, 8.7 KB (added by pienoz, 5 years ago)
Line 
1<?php
2
3// Get the last published podcast related to the current show.
4$args = array(
5 'post_type' => 'emission',
6 'posts_per_page' => 1,
7 'meta_query' => array(
8 'show_clause' => array(
9 'key' => '_sud_programme',
10 'value' => $post->ID,
11 ),
12 'date_clause' => array(
13 'key' => '_sud_date_emission',
14 'value' => date_format(date_create(), $date_format),
15 'compare' => '<=',
16 ),
17 ),
18 'ignore_sticky_posts' => true,
19 'orderby' => 'date_clause',
20 'order' => 'DESC',
21);
22// Pass this podcast in the main query to display it in details.
23global $wp_query;
24
25query_posts($args);
26$wp_query->is_single = 1;
27$wp_query->is_singular = 1;
28$wp_query->is_archive = 0;
29$idChronique= $post->ID;
30
31//print_r($wp_query);
32 get_header();
33 get_template_part('phpincludes/menu');
34 get_template_part('phpincludes/part-searchbar');
35
36 $right_sidebar_slug = 'post-show-and-podcast-right-sidebar';
37 $right_sidebar = is_active_sidebar($right_sidebar_slug);
38?>
39 <?php
40 hm_get_template_part('phpincludes/sud-ads', [
41 'area' => 'header',
42 ]);
43 hm_get_template_part('phpincludes/sud-ads', [
44 'area' => 'background',
45 ]);
46 ?>
47 <article id="maincontent" class="qt-main" itemscope itemtype="http://schema.org/RadioSeries">
48 <div class="sud-post qt-spacer-s">
49
50 <?php while (have_posts()) : the_post(); ?>
51 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
52 <div class="qt-container">
53 <div class="row">
54 <div class="col s12<?php echo $right_sidebar ? ' m9' : ''; ?>">
55 <div class="qt-the-content">
56 <header class="sud-post__header">
57 <?php echo programme_maitre($idChronique); ?>
58 <?php the_title('<h1 class="sud-post__title qt-caption" itemprop="name">', '</h1>'); ?>
59
60 <div class="sud-post__meta">
61 <?php if (get_the_terms($post->ID, 'animateur')) : ?>
62 <div class="sud-post__meta-author sud-author">
63 <?php
64 $author = get_the_term_list($post->ID, 'animateur', 'Par <address itemprop="author">', '</address> et <address itemprop="author">');
65 echo strip_tags($author, '<address>');
66 ?>
67
68 <?php
69 $guests = get_podcast_guests($post);
70 if ($guests) :
71 ?>
72 <span class="sud-post__meta-guests">
73 avec <?php echo implode(', ', array_column($guests, '_sud_invite')); ?>
74 </span>
75 <?php endif; ?>
76 </div>
77 <?php endif; ?>
78
79 <?php
80 $date = $post->_sud_date_emission;
81 if ($date) :
82 $date_frmt = get_option('date_format') ? get_option('date_format') : 'l j F Y';
83 $friendly_date = wp_date($date_frmt, date_format(date_create($date), 'U'));
84 ?>
85 <div class="sud-post__meta-date">
86 <time datetime="<?php echo $date; ?>" itemprop="datePublished">
87 <?php echo 'Émission du '.$friendly_date; ?>
88 </time>
89 </div>
90 <?php endif; ?>
91
92 <hr class="qt-spacer-s">
93
94 <div class="sud-post__meta-share">
95 <?php get_template_part('phpincludes/sharepage'); ?>
96 </div>
97 </div>
98 </header>
99
100 <?php if (get_the_excerpt()) : ?>
101 <blockquote class="sud-post__excerpt sud-excerpt" itemprop="about">
102 <?php the_excerpt(); ?>
103 </blockquote>
104 <?php endif; ?>
105
106 <?php
107 hm_get_template_part('phpincludes/sud-post/post-video', [
108 'video_url' => $post->_sud_replayvideo,
109 ]);
110 ?>
111
112 <div class="sud-post__content" itemprop="description">
113 <?php the_content(); ?>
114 <hr class="qt-spacer-m">
115 </div>
116
117 <?php
118 hm_get_template_part('phpincludes/sud-show/show-podcast', [
119 'podcast' => $post,
120 'hide_excerpt' => true,
121 'disable_toggle' => true,
122 ]);
123 ?>
124
125 <?php if (isset($guests)) : ?>
126 <aside class="sud-post__guests qt-spacer-m">
127 <h5 class="qt-caption-small">
128 <span>Les invités</span>
129 </h5>
130 <table>
131 <?php foreach ($guests as $guest) : ?>
132 <tr itemprop="contributor" itemscope itemtype="https://schema.org/Person">
133 <th scope="row" itemprop="name"><?php echo $guest['_sud_invite']; ?></th>
134 <td itemprop="description"><?php echo $guest['_sud_bio_invite']; ?></td>
135 </tr>
136 <?php endforeach; ?>
137 </table>
138 </aside>
139 <?php endif; ?>
140
141 <?php
142 $show = get_post($post->_sud_programme);
143 if ($show) :
144 ?>
145 <aside class="sud-post__info qt-spacer-m">
146 <h5 class="qt-caption-small">
147 <span>Le programme</span>
148 </h5>
149 <?php echo $show->post_content; ?>
150 </aside>
151 <?php endif; ?>
152 </div>
153 <hr class="qt-spacer-m">
154 </div>
155
156 <?php if ($right_sidebar) : ?>
157 <div class="qt-sidebar col s12 m3 hide-on-med-and-down">
158 <?php
159 hm_get_template_part('phpincludes/sidebar', [
160 'sidebar' => $right_sidebar_slug,
161 ]);
162 ?>
163 </div>
164 <?php endif; ?>
165 </div>
166 </div>
167 </div>
168 <?php endwhile; ?>
169
170 <?php
171 hm_get_template_part('phpincludes/sud-post/post-related-shows', [
172 'podcast' => $post,
173 ]);
174 ?>
175
176 <?php get_template_part('phpincludes/sud-scripts'); ?>
177 </div>
178 </article>
179
180 <?php
181 hm_get_template_part('phpincludes/sud-ads', [
182 'area' => 'sidebar',
183 ]);
184 hm_get_template_part('phpincludes/sud-ads', [
185 'area' => 'footer',
186 ]);
187 ?>
188<?php
189 get_template_part('phpincludes/footerwidgets');
190 get_footer();
191?>