Filter media embed tags from podcast feed

Issue #62 resolved
Allen Cox created an issue

member, Bodie Quirk, is using slideshare media embed to display corresponding sermon slides on sermon posts. The problem is that the <iframe> tags are failing podcast feed validation. Please add a filter to remove <iframe> content from sermon feed.!

Screen Shot 2015-07-27 at 2.20.21 PM.png

Comments (10)

  1. Bodie Quirk

    Or, you could just change the CSS so the audio player doesn't disappear when content is in the audio box?

  2. Allen Cox reporter

    Its not in the CSS. The code tests presence of video media and if true eliminates the call for audio media. See line 227 in template_tags.php...here is a screenshot

    video_replace_audio.JPG

    perhaps you can do remove_action for this and add your own? That is why the dev thinks it is better to just filter the <iframe> content out of description field.

  3. Allen Cox reporter

    so are you going to insert a remove/add action to replace this function in your functionality plugin? To make your edits update-proof you know...

  4. Bodie Quirk

    Yes, that is definitely the right way to do it! I just wanted to see if that change worked. It did, for a second, and now it’s not working. Anyways, I will keep on it! Thanks for all your help.

    B

  5. Allen Cox reporter

    UPDATE: [copied from private email to Bodie] As for the original problem, I did get the developer to sit down and look at our plugin code to determine the root problem and it appears that we may have identified it but do not have a timetable yet for fixing it. WordPress feed generation is automatically creating enclosure tags for any post with an MP3 file attached to the post. Additionally, SM podcast function is inserting an enclosure tag for any MP3 URL referenced in the sermon post field. This explains why some posts have double enclosures while others have just one. Any sermon that has the MP3 URL pasted into the MP3 URL field (vs. uploading and attaching to sermon) will not be recognized by the WordPress feed generation and therefore skipped resulting in only one enclosure tag from SM.

    Action: create code that will test to see if MP3 is attached to post and if so remove SM enclosure tag (because WP will generate enclosure tag if MP3 is attached)

  6. Allen Cox reporter

    Bodie's code function tip/fix for this specific issue

    // Remove existing sermon media function
    remove_action ('sermon_media', 'wpfc_sermon_media', 5);
    
    add_action ( 'sermon_media', 'bq_wpfc_sermon_media', 5);
    /**
     * Return all media if it exists
     */
    function bq_wpfc_sermon_media() {
    
            // if there are notes, link to them.
        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>';
        }
    
            // if there's audio, do the shortcode
        if (get_wpfc_sermon_meta('sermon_audio') ) {
            echo '<div class="wpfc_sermon-audio cf">';
                $mp3_url = get_wpfc_sermon_meta('sermon_audio');
                $attr = array(
                'src'      => $mp3_url,
                'preload' => 'none'
                );
                echo wp_audio_shortcode( $attr );
            echo '</div>';
        } 
    
        // if there's video, do the shortcode
        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>';                                
        } 
    
    }
    
  7. Log in to comment