Changing Multiple Enclosures to single ones for iTunes 4.9 etc.
-
hi all
i have been using multiple enclosures in my https://www.de-bug.de/pod/ netaudio podcast for quite some time, but with itunes 4.9 it seemed necessary, to convert them into single ones, or at least produce a feed, that puts every single one of the mp3s in one posting in a seperate item. a friend came up with a “dirty” solution for it and i thought you would have some use for it.instead of:
<?php rss_enclosure(); ?>
in wp-rss2.php paste:
<?php
$rss_first = 1;
$custom_fields = get_post_custom();
if(!is_array( $custom_fields ) ) {print("</item>");}
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 );
if ($rss_first == 1) {
$rss_first = 0;
print "<enclosure url='".trim( htmlspecialchars($enclosure[ 0 ]) )."' length='".trim( $enclosure[ 1 ] )."' type='".trim( $enclosure[ 2 ] )."'/>\n</item>\n";
} else {
?>
<item>
<title><?php the_title_rss() ?></title>
<link><?php permalink_single_rss() ?></link>
<comments><?php comments_link(); ?></comments>
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
<dc:creator><?php the_author() ?></dc:creator>
<?php the_category_rss() ?><guid><?php print($enclosure[ 0 ]); ?></guid>
<?php if (get_settings('rss_use_excerpt')) : ?>
<description><![CDATA[<?php print("more") ?>]]></description>
<?php else : ?>
<description><![CDATA[<?php print("more") ?>]]></description>
<?php if ( strlen( $post->post_content ) > 0 ) : ?>
<content:encoded><![CDATA[<?php print("more") ?>]]></content:encoded>
<?php else : ?>
<content:encoded><![CDATA[<?php print("more") ?>]]></content:encoded>
<?php endif; ?>
<?php endif; ?>
<wfw:commentRSS><?php echo comments_rss(); ?></wfw:commentRSS>
<?php
print "<enclosure url='".trim( htmlspecialchars($enclosure[ 0 ]) )."' length='".trim( $enclosure[ 1 ] )."' type='".trim( $enclosure[ 2 ] )."'/>\n</item>\n";
}
}
}
}
}
}
?>and upload with another name.
works for me ??
https://www.de-bug.de/pod/wp-itunes-rss2.php
https://www.de-bug.de/pod/archives/565.html
- The topic ‘Changing Multiple Enclosures to single ones for iTunes 4.9 etc.’ is closed to new replies.