Skip to content

Commit 047e1d7

Browse files
author
Nikola Miljković
authored
Merge pull request #35 from WP-for-Church/dev
Release 2.1.0
2 parents 0f91ca1 + ea15344 commit 047e1d7

8 files changed

Lines changed: 106 additions & 34 deletions

File tree

css/bibly.min.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/plyr.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/template-tags.php

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -315,18 +315,32 @@ function wpfc_sermon_media() {
315315
} elseif ( ! get_wpfc_sermon_meta( 'sermon_video' ) && ! get_wpfc_sermon_meta( 'sermon_video_link' ) && get_wpfc_sermon_meta( 'sermon_audio' ) ) {
316316
$html = '';
317317
$html .= '<div class="wpfc_sermon-audio cf">';
318-
$mp3_url = get_wpfc_sermon_meta( 'sermon_audio' );
319-
$attr = array(
320-
'src' => $mp3_url,
321-
'preload' => 'none'
322-
);
323-
$html .= wp_audio_shortcode( $attr );
318+
$html .= wpfc_render_audio( get_wpfc_sermon_meta( 'sermon_audio' ) );
324319
$html .= '</div>';
325320

326321
return $html;
327322
}
328323
}
329324

325+
/**
326+
* Renders the audio player
327+
*
328+
* @param string $url The URL of the audio file
329+
*
330+
* @return string Audio player HTML
331+
*/
332+
function wpfc_render_audio( $url = '' ) {
333+
if ( ! is_string( $url ) || trim( $url ) === '' ) {
334+
return '';
335+
}
336+
337+
$output = '<audio controls>';
338+
$output .= '<source src="' . $url . '">';
339+
$output .= '</audio>';
340+
341+
return $output;
342+
}
343+
330344
// legacy function
331345
function wpfc_sermon_files() {
332346
do_action( 'sermon_media' );
@@ -336,12 +350,7 @@ function wpfc_sermon_files() {
336350
function wpfc_sermon_audio() {
337351
$html = '';
338352
$html .= '<div class="wpfc_sermon-audio cf">';
339-
$mp3_url = get_wpfc_sermon_meta( 'sermon_audio' );
340-
$attr = array(
341-
'src' => $mp3_url,
342-
'preload' => 'none'
343-
);
344-
$html .= wp_audio_shortcode( $attr );
353+
$html .= wpfc_render_audio( get_wpfc_sermon_meta( 'sermon_audio' ) );
345354
$html .= '</div>';
346355

347356
return $html;
@@ -368,7 +377,7 @@ function wpfc_sermon_attachments() {
368377
}
369378
}
370379
if ( get_wpfc_sermon_meta( 'sermon_audio' ) ) {
371-
$html .= '<a href="' . get_wpfc_sermon_meta( 'sermon_audio' ) . '" class="sermon-attachments"><span class="dashicons dashicons-media-audio"></span>' . __( 'MP3', 'sermon-manager' ) . '</a>';
380+
$html .= '<a href="' . get_wpfc_sermon_meta( 'sermon_audio' ) . '" class="sermon-attachments"><span class="dashicons dashicons-media-audio" download="true"></span>' . __( 'MP3', 'sermon-manager' ) . '</a>';
372381
}
373382
if ( get_wpfc_sermon_meta( 'sermon_notes' ) ) {
374383
$html .= '<a href="' . get_wpfc_sermon_meta( 'sermon_notes' ) . '" class="sermon-attachments"><span class="dashicons dashicons-media-document"></span>' . __( 'Notes', 'sermon-manager' ) . '</a>';

includes/types-taxonomies.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ function wpfc_sermon_metaboxes() {
288288
'desc' => __( 'Select the type of service. Modify service types in Sermons -> Service Types.', 'sermon-manager' ),
289289
'id' => 'wpfc_service_type',
290290
'type' => 'select',
291+
'show_option_none' => true,
291292
'options' => cmb2_get_term_options( 'wpfc_service_type' ),
292293
) );
293294
$cmb->add_field( array(

0 commit comments

Comments
 (0)