Okay
  Public Ticket #2254146
Linking a image to a certain song
Closed

Comments

  • Edwin started the conversation

    Hello,

    Is it possible (with Elementor) to link a image to a certain song. So that a viewer can click on an image and the MP3 player starts that song?

    Kind regards Edwin

  •  1,103
    Max replied

    Hi,

    Yes, you can create a javascript call to fire the player when user click on an image.

    for this, add this javascript call in the image url link of your image. ( https://d.pr/i/lqNk8h )

    javascript:IRON.sonaar.player.setPlayer({id:1218})

    Replace id:1218 by the ID of your playlist.  The ID is your playlist post id that can be found by going to wp-admin > playlist. See screenshot: https://d.pr/i/8f2US2


    Thanks,


    Max from the Sonaar.io Crew

  • Edwin replied

    Hello,

    Is it also possible to link the image to a certain song in that playlist? I intend to add the playlist within a shortcode in an element but would like to have multiple images click-able for the specific songs.


    Kind regards,


    Edwin

  •  1,103
    Max replied

    Try this:

    IRON.sonaar.player.setPlayer({ id:"1218", trackid:"2"})

    Where trackid:"0" would be the first track of the playlist, trackid:"1" the second track, trackid:"2" the third track, etc.


    Thanks,


    Max from the Sonaar.io Crew

  • Edwin replied

    Maxime,

    It doesn't seem to start any song. I have change the ID to the correct number. The playlist is added to the same page via a shortcode. Is that a problem?

    This is the page: https://www.kuronline.be/direct-een-kur/paard-vlp-1

    Edwin

  •  1,103
    Max replied

    Hi,

    please buy the pro version and I will provide you a custom JS to make it works as you wish

    You can buy the player here: https://sonaar.io/free-mp3-music-player-plugin-for-wordpress/

    Thanks,


    Max from the Sonaar.io Crew

  • Edwin replied

    Done.

  •  1,103
    Max replied

    Alright,

    ok try this:

    javascript:jQuery('[data-albums="1218"]').find('li:nth-child(2) .audio-track').trigger( "click" );

    replace data-albums id number by your album id and nth-child(2) by the track number you want to play

    If it does not work, please provide me access to your wp-admin. tell me how it goes.

    Thanks,


    Max from the Sonaar.io Crew