0

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

6
  • What do you see if you var_dump($EpisodeData) before the if statement? Apr 1, 2016 at 0:53
  • bool(false) is what shows Apr 1, 2016 at 0:56
  • It should ask to plugin author, BUT since you have $post->ID in your code, I need to ask, is your code in the loop? how the loop code look like?
    – Jevuska
    Apr 1, 2016 at 1:36
  • The code I am using looks like: pastebin.com/MBGp6L8W Apr 1, 2016 at 1:43
  • So, after looking into this a little, it seems like this is a little tougher than I initially envisioned. What I'd like to do is simply disable the mobile player and use the same player that the regular site uses on mobile...would that be easier? I figured outputting the url and creating my own player might be easier, now I'm not so certain. Apr 1, 2016 at 2:19

1 Answer 1

0

So, I have no idea how it happened, maybe it's a PowerPress thing...I activated the HTML 5 player, then went back and reactivated MediaElement's player and the issue resolved itself. Now, everything looks as expected on mobile.

Thanks,
Josh

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.