Thread Starter
Orin
(@orin)
No one knows the answer to such a question?
Thread Starter
Orin
(@orin)
Bah. After much investigation I’ve solved this myself. I did it by finding the rss_enclosure
function in feed-functions.php and modifying it, since it’s not usable in html. Here’s how I wrote mine:
<?php if (get_post_custom_values(enclosure)!='') {
while(list($key, $val) = each( get_post_custom() )) {
if($key == 'enclosure') {
if (is_array($val)) {
foreach($val as $enc) {
$enclosure = split( "n", $enc );
print
'<a href="'.trim( htmlspecialchars($enclosure[0]) ).'"
title="Download '.trim($enclosure[3]).'">
' .trim($enclosure[3]). '</a>';
}
}
}
}
}
Line breaks have been added for clarity. Note that I added a fourth attribute for my enclosure field ($enclosure[3])
where I write the custom title that will appear on the page. This code is currently in use on a torrent podcasting blog I do.
For anyone else that seeks to do this (assumably common) task, I hope I’ve been a help.
I think you have modified the wrong code. You don’t really want a link in your RSS feed.
Here is a hack that I have done to place the enclosure link under the title of a post.
Put this function into the template-functions-post.php file
function the_enclosure() {
global $id;
$encl = &get_post_meta($id,'enclosure',true);
return "Direct <a href=\"".$encl."\">Link</a> to the show";
}
}
Then, put this code in your theme files inside the post loop, themes\default\single.php and themes\default\page.php and themes\default\index.php.
<?php echo the_enclosure(); ?>
Hi,
This is exactly what I want to do, but I can’t get either of your solutions to work. are you both using 1.5?
Orin, what i’m trying to do is dynamically build a xspf playlist based on the linked enclosure in my post. I’m then trying to link a flash mp3 player to that playlist.
So right now I have a seperate playlist.php file that I’m trying to load with the url of the mp3 enclosure attached to my post. I’m not having a lot of luck getting your solutions to work. any help is appreciated.