• I’m trying to hack together a plugin that if a post has an enclosure that it will output a Flash audio player for that audio enclosure. I’m using http://musicplayer.sourceforge.net/ for the MP3 player. I grabbed the code out of feed-functions.php and have been tweaking it but am not able to get the plugin to return the post + the enclosure/player.

    function rss_enclosure_player() {
    global $id, $post;
    if (!empty($post->post_password) && ($_COOKIE[‘wp-postpass_’.COOKIEHASH] != $post->post_password)) return;

    $custom_fields = get_post_custom();
    if( is_array( $custom_fields ) ) {
    while( list( $key, $val ) = each( $custom_fields ) ) {
    if( $key == ‘enclosure’ ) {
    if (is_array($val)) {
    foreach($val as $enc) {
    $enclosure = split( “n”, $enc );
    $text = $the_content . trim( htmlspecialchars($enclosure[ 0 ]) );
    return $text;
    }
    }
    }
    }
    }
    }

    add_filter(‘the_content’, ‘rss_enclosure_player’);

    For right now I’m just trying to get it to return the enclosure URL – then I’ll focus on integrating the player. This code only outputs the enclosure URL – it doesn’t append it to the post content.

    Thanks for your help!

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Flash Player for Podcast Enclosures’ is closed to new replies.