WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Sermon Manager] Display Video & Audio...not "elseif" (6 posts)

  1. JMSexton
    Member
    Posted 1 year ago #

    Right now Sermon Manger defaults to video, if you have both an audio version and a video version of the sermon uploaded. We want user to have the option of audio or video. I know it would require a lot more code work to be able to select one or the other so for now we just want to display both audio and video and they can choose which to play. I know it's an issue with the ifelse statement, but don't know what to change it to so it will show both. The code snippet is below. Thanks for any help!

    // render files section
    function wpfc_sermon_files() {
    	if ( get_wpfc_sermon_meta('sermon_video') ) {
    		echo '<div id="wpfc_sermon-video" class="cf">';
    			echo do_shortcode( get_wpfc_sermon_meta('sermon_video'));
    		echo '</div>';
    	} ifelse ( !get_wpfc_sermon_meta('sermon_video') && get_wpfc_sermon_meta('sermon_audio') ) {
    		echo '<div id="wpfc_sermon-audio" class="cf">';?>
    			<script>
    				jQuery.noConflict();
    				jQuery(document).ready(function(){
    					jQuery('audio').mediaelementplayer();
    				});
    			</script> <?php
    			echo '<audio controls="controls">';
    				echo '<source src="' . get_wpfc_sermon_meta('sermon_audio') . '"  type="audio/mp3" />';
    			echo '</audio>';
    		echo '</div>';
    	}
  2. joshdd
    Member
    Posted 1 year ago #

    Did you work this out?

    I use a shortcode to provide a download link, and because the description bit doesn't take shortcodes, I'm putting the download link in the video embed section, but I don't want that to replace the audio.

  3. joshdd
    Member
    Posted 1 year ago #

    Btw, this would work:

    // render files section
    function wpfc_sermon_files() {
    	if ( get_wpfc_sermon_meta('sermon_video') ) {
    		echo '<div class="wpfc_sermon-video cf">';
    			echo do_shortcode( get_wpfc_sermon_meta('sermon_video'));
    		echo '</div>';
    	}
    	if ( get_wpfc_sermon_meta('sermon_audio') ) {
    		echo '<div class="wpfc_sermon-audio cf">';?>
    			<script>
    				jQuery.noConflict();
    				jQuery(document).ready(function(){
    					jQuery('audio').mediaelementplayer();
    				});
    			</script> <?php
    			echo '<audio controls="controls">';
    				echo '<source src="' . get_wpfc_sermon_meta('sermon_audio') . '"  type="audio/mp3" />';
    			echo '</audio>';
    		echo '</div>';
    	}
    	if ( get_wpfc_sermon_meta('sermon_notes') ) {
    		echo '<div class="wpfc_sermon-notes cf">';
    			echo '<a href="' . get_wpfc_sermon_meta('sermon_notes') . '" class="sermon-notes">'.__( 'Notes', 'sermon-manager').'</a>';
    		echo '</div>';
    	}
    }

    Does work, I just tested it on mine.

  4. thegsides
    Member
    Posted 1 year ago #

    Like this plugin but having the same issue - the code you listed above...

    where exactly does that go?

  5. joshdd
    Member
    Posted 1 year ago #

    I'm sorry, it's been a while since I did that and I'm not able to get onto the site that I did it for anymore - when I return home in a week I will check my backups and see if I can provide you with more detailed information.

    There is possibly a better way to do it though, I just kind of did that as a temporary fix and then stuck with it.

    Josh.

  6. khornberg
    Member
    Posted 10 months ago #

    @thegsides
    includes/template-tags.php line 247

Topic Closed

This topic has been closed to new replies.

About this Topic