I am trying to display the url of a media file in a template. I ran across this post: https://wordpress.org/support/topic/get-media-url-only, but when I add that to my template (in the loop as it says) nothing shows.
So, I am not sure which is easier...to display what the field in the WordPress admin panel is in the template which looks like:
<input type="text" id="powerpress_url_general" class="powerpress-url" name="Powerpress[general][url]" value="myfile.mp3" style="width: 70%;">
or to try something like: https://wordpress.org/support/topic/get-media-url-only (maybe a function has changed).
This is what I have that doesn't output anything:
if( function_exists('powerpress_get_enclosure_data') ) {
$EpisodeData = powerpress_get_enclosure_data($post->ID);
if( $EpisodeData ) {
$url = $EpisodeData['url'];
echo $url;
}
}
Am I missing something? Shouldn't the code I have output the url I am looking for?
Thanks,
Josh
var_dump($EpisodeData)
before the if statement?$post->ID
in your code, I need to ask, is your code in the loop? how the loop code look like?