This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent-audio.php
50 lines (50 loc) · 1.78 KB
/
content-audio.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
<?php if( is_singular() ): ?>
<div class="row mb-3">
<div class="col">
<h1><?php the_title(); ?></h1>
</div>
</div>
<?php if(get_post_meta( $post->ID , 'audio_link', true)): ?>
<?php
$audioID = get_post_meta( $post->ID, 'audio_link', true );
if($audioID){
$audioSrc = wp_get_attachment_url( $audioID );
}
?>
<div class="row mb-3">
<div class="col">
<div class="audioWrapper">
<audio controls>
<source src="<?= $audioSrc ?>">
Your browser does not support the audio element.
</audio>
</div>
</div>
</div>
<?php endif; ?>
<div class="row mb-3">
<div class="col">
<div class="content">
<div class="wp_content"><?php the_content(); ?></div>
</div>
</div>
</div>
<?php else: ?>
<div class="singlePost pb-2 pt-2 border-bottom">
<div class="row">
<?php if(has_post_thumbnail()): ?>
<div class="col-12 col-md-6 col-lg-4">
<?php the_post_thumbnail('medium_large', ['class' => 'img-fluid', 'title' => get_the_title()]); ?>
</div>
<?php endif; ?>
<div class="col p-2">
<div class="card-block px-2">
<h6 class="text-muted"><?= get_the_date('F j, Y'); ?></h6>
<h4 class="card-title"><?php the_title(); ?></h4>
<?php the_excerpt(); ?>
<a href="<?= get_post_permalink() ?>" class="btn btn-whtn">Listen to the Audio Here</a>
</div>
</div>
</div>
</div>
<?php endif; ?>