1 <?php |
|
2 /** |
|
3 * Template part for displaying audio posts |
|
4 * |
|
5 * @link https://codex.wordpress.org/Template_Hierarchy |
|
6 * |
|
7 * @package WordPress |
|
8 * @subpackage Twenty_Seventeen |
|
9 * @since 1.0 |
|
10 * @version 1.2 |
|
11 */ |
|
12 |
|
13 ?> |
|
14 |
|
15 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
|
16 <?php |
|
17 if ( is_sticky() && is_home() ) { |
|
18 echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) ); |
|
19 } |
|
20 ?> |
|
21 <header class="entry-header"> |
|
22 <?php |
|
23 if ( 'post' === get_post_type() ) { |
|
24 echo '<div class="entry-meta">'; |
|
25 if ( is_single() ) { |
|
26 twentyseventeen_posted_on(); |
|
27 } else { |
|
28 echo twentyseventeen_time_link(); |
|
29 twentyseventeen_edit_link(); |
|
30 }; |
|
31 echo '</div><!-- .entry-meta -->'; |
|
32 }; |
|
33 |
|
34 if ( is_single() ) { |
|
35 the_title( '<h1 class="entry-title">', '</h1>' ); |
|
36 } elseif ( is_front_page() && is_home() ) { |
|
37 the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' ); |
|
38 } else { |
|
39 the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); |
|
40 } |
|
41 ?> |
|
42 </header><!-- .entry-header --> |
|
43 |
|
44 <?php |
|
45 $content = apply_filters( 'the_content', get_the_content() ); |
|
46 $audio = false; |
|
47 |
|
48 // Only get audio from the content if a playlist isn't present. |
|
49 if ( false === strpos( $content, 'wp-playlist-script' ) ) { |
|
50 $audio = get_media_embedded_in_content( $content, array( 'audio' ) ); |
|
51 } |
|
52 |
|
53 ?> |
|
54 |
|
55 <?php if ( '' !== get_the_post_thumbnail() && ! is_single() ) : ?> |
|
56 <div class="post-thumbnail"> |
|
57 <a href="<?php the_permalink(); ?>"> |
|
58 <?php the_post_thumbnail( 'twentyseventeen-featured-image' ); ?> |
|
59 </a> |
|
60 </div><!-- .post-thumbnail --> |
|
61 <?php endif; ?> |
|
62 |
|
63 <div class="entry-content"> |
|
64 |
|
65 <?php |
|
66 if ( ! is_single() ) { |
|
67 |
|
68 // If not a single post, highlight the audio file. |
|
69 if ( ! empty( $audio ) ) { |
|
70 foreach ( $audio as $audio_html ) { |
|
71 echo '<div class="entry-audio">'; |
|
72 echo $audio_html; |
|
73 echo '</div><!-- .entry-audio -->'; |
|
74 } |
|
75 }; |
|
76 |
|
77 }; |
|
78 |
|
79 if ( is_single() || empty( $audio ) ) { |
|
80 |
|
81 /* translators: %s: Name of current post */ |
|
82 the_content( sprintf( |
|
83 __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ), |
|
84 get_the_title() |
|
85 ) ); |
|
86 |
|
87 wp_link_pages( array( |
|
88 'before' => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ), |
|
89 'after' => '</div>', |
|
90 'link_before' => '<span class="page-number">', |
|
91 'link_after' => '</span>', |
|
92 ) ); |
|
93 |
|
94 }; |
|
95 ?> |
|
96 |
|
97 </div><!-- .entry-content --> |
|
98 |
|
99 <?php |
|
100 if ( is_single() ) { |
|
101 twentyseventeen_entry_footer(); |
|
102 } |
|
103 ?> |
|
104 |
|
105 </article><!-- #post-## --> |
|