• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

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

Subscribe to my YouTube Channel

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

Download Folder

How The Link is Added

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.

Related Solutions

  • Podcast Category Archive Page Template for Genesis
  • Single Post Audio or Video Template for Podcasting in Genesis

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.