Custom RSS Feeds & Post Meta Data

Rss feeds normally display media files along with post excerpts. I am using post meta to add media files to a post. Unfortunately, since the audio file is not being inserted into the main textarea the audio files are not being displayed in the RSS feed. How can I edit the RSS feed in such a way that the rss_enclosure() displays media files from post meta?

This is the code I’m using to edit the RSS feed:

function custom_postrss( $content ) {
global $wp_query;
$postid = $wp_query->post->ID;
$audiourl = get_post_meta( $postid, 'custom_audio_url', true );

if( is_feed() ){
    $content = '<div class="media">This post has an audio file. '.$content.'Subscribe for more.'.$audiourl.'</div><!-- .media -->';
return $content;
add_filter('the_excerpt_rss', 'custom_postrss');
add_filter('the_content', 'custom_postrss');

This only returns the URL, but not the media file box that is usually seen in RSS feeds. Any ideas? I’d be happy for any pointers.

Solutions Collecting From Web of "Custom RSS Feeds & Post Meta Data"