Download a Different File Than What is Being Played in the WordPress Audio Player

Plugin:

Wonder Audio Player

Tutorial:

In the Wonder Audio Player plugin, you can easily create a player with download buttons in the playlist. When clicking the button, it will download the audio file that is being played.

However, in some cases, you may want to download a different file than what is being played. For example, you might want to download a PDF script file or a larger WAV file instead of the smaller MP3 file. This tutorial will guide you on how to do it.

An online demo is below. When the download button is clicked, it will download a PDF file instead of the MP3 file being played.

Step 1 - Add the download URL and file name to the audio file

In Wonder Audio Player, edit the player, and in step 1, edit the audio. In the Add Audio dialog, enter the download file URL in the Information input box.

audio-player-download-url

Step 2 - Add the download button to the playlist

In step 2, Skins tab, select the skin "White Box." We will create the player based on this skin.

In step 3, Options tab, navigate to the Playlist tab, check the option "Customize the playlist item format," and enter the following text into the input box:

<div class='amazingaudioplayer-item-id'>%ID%</div>
<div class='amazingaudioplayer-item-info'><a href="%INFO%" class="wonderaudio-button-link wonderaudio-download-link" download target="_blank" onclick="event.stopPropagation();"><div class="mhicon-download wonderaudio-button wonderaudio-download"></div></a></div>
<div class='amazingaudioplayer-item-title'>%TITLE%</div>

In step 3, Options tab, navigate to the Player Text & Controls tab, delete the following line from the Show Information input box:

<div class='amazingaudioplayer-info-description'>%INFO%</div>

This is because we used the Information text, which will replace the macro %INFO%, as the download URL, so we need to remove it from the player display.

Step 3 - Save and publish the player

Save and publish the player, then add the player shortcode to a page or post.