download button acts differently when triggered through field vs when hardcoded

Support MB Views download button acts differently when triggered through field vs when hardcodedResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #44136
    EddyPiVEddyPiV
    Participant

    Hi,

    I have a View for cpt "Song", in the View the audio of the song can be played and downloaded.

    If the code for the download button is hardcoded like this, it downloads nicely:

    <div class="wp-block-file"><a href="https://mydomain.com/popkoor/wp-content/uploads/sites/53/2023/12/the_song.mp3" class="wp-block-file__button wp-element-button" download>Download</a></div>

    But if it is like this, the button starts playing the audio first and from there the file can be downloaded through the 3 vertical dots:

    <div class="wp-block-file"><a href="{{ clone.audio }}" class="wp-block-file__button wp-element-button" download>Download</a></div>

    Have a look here: https://digitopress.staging.wpmudev.host/popkoor/song/showcase/
    The download button at the bottom is hardcoded and works immediately.

    How can I eliminate that extra step and have the button acting immediately?

    #44141
    PeterPeter
    Moderator

    Hello Eddy,

    What is the audio field type? I assume it is file field. Then you can output the file URL in the HTML code. For example:

    <div class="wp-block-file"><a href="{{ clone.audio.url }}" class="wp-block-file__button wp-element-button" download>Download</a></div>

    #44143
    EddyPiVEddyPiV
    Participant

    Peter, the audio was file type URL.
    I tried various scenarios, and with File Input it works properly. That file type fits perfectly, as all music is already in the media library.

    So thanks for your help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.