×
Cyber Monday Sale!
00Days
:
00Hours
:
06Minutes
:
17Seconds
Use Coupon 40%OFF

Includes 1 Year Priority Support

Shop Now

WP SITES

3093 Coded Tutorials & 297 Plugins

Add Download Link To Audio Player in WordPress

This post contains a download folder with templates for use with the native WordPress audio player.

The templates also include a button which enables your readers to download a copy of the audio file to their local computer.

download-link

The method of adding this link uses pure PHP code with a div class to add a button or style the link anyway you like.

Video Demo

Here’s the folder which includes the templates with code for adding the link to download your audio files:

The download button is added using the following line of code in the single-podcast.php file:

printf( '<a href="%s" class="download-link button download">' . __( 'Download' ) . '</a>', $media_link );

The above code only works with the single-podcast.php file and uses the file URL you add to the custom field value field on any Edit Post screen.

audio-link

After you upload your audio file to the WordPress media library, simply grab the full URL and paste it into the value field with the audio_link custom field key as seen above.

The code in the single-podcast.php file pulls the file URL from the custom field and adds it to a link which is styled as a download button. Simple as that.

No need to modify the WordPress core MediaElement code or use any other method to add the link.

Was this helpful?

Yes
No
Thanks for your feedback!

2 responses to “Add Download Link To Audio Player in WordPress”

  1. Single Post Audio or Video Template for Podcasting in Genesis

    […] Add Download Link To Audio Player in WordPress […]

  2. Podcast Category Archive Page Template for Genesis

    […] Add Download Link To Audio Player in WordPress […]

Leave a Reply