Okay
  Public Ticket #2729821
Error - elementor mp3 player
Closed

Comments

  • Nils started the conversation

    I'm getting an error when I use the mp3 player (pro version) on Elementor single post theme created using Elementor theme builder. I don't get the same issue when I create a single page in elementor. The error reads as follows: 

    Warning: Invalid argument supplied for foreach() in /home/customer/www/andyt56.sg-host.com/public_html/wp-content/plugins/mp3-music-player-by-sonaar/includes/class-sonaar-music-widget.php on line 596

    Warning: count(): Parameter must be an array or an object that implements Countable in /home/customer/www/andyt56.sg-host.com/public_html/wp-content/plugins/mp3-music-player-by-sonaar/includes/class-sonaar-music-widget.php on line 655

    Warning: array_merge(): Expected parameter 2 to be an array, null given in /home/customer/www/andyt56.sg-host.com/public_html/wp-content/plugins/mp3-music-player-by-sonaar/includes/class-sonaar-music-widget.php on line 706


    Many thanks for your help!

  •  1,103
    Max replied

    Hi,

    Could you please provide me access to your wp-admin and I will gladly check the issue you have.


    Thanks,


    Max from the Sonaar.io Crew

  •   Nils replied privately
  •  1,103
    Max replied

    If you want a dynamic player, use this option instead: https://d.pr/i/JDJMj4

    .

    this will connect to the single post tracklist. eg: https://d.pr/i/DwNivs

    So the idea is to edit your single post with WordPress and fill the custom field with the mp3 track you want to play in your global player.


    Thanks,


    Max from the Sonaar.io Crew

  • Nils replied

    Thanks Max. Can you tell me the metakey of the external url field?

    I need to add a custom field (using ACF) for this so that I can edit this outside the Wordpress post editor.

    Cheers!

  • Nils replied

    Apologies, updated screenshot. I need the metakeys for these two fields: URL and Track Title.

  •  1,103
    Max replied

    Hi,

    the fields are done via CMB2 (similar than ACF). 

    you can check the name by inspecting the DOM with your browser console and check for ID. See screenshot: 

    The name of the first field is alb_tracklist_0_FileOrStream1 where 0 represent the first track since its a repeater field and 1 is for the MP3. 2 would be the external link radio button

    The name of the second field is alb_tracklist_0_track_mp3

    Thanks,


    Max from the Sonaar.io Crew

  • Nils replied

    Hi Max,

    Thanks very much for this. I assumed the meta would work in ACF but I guess I am wrong as I can't get it to work.

    Do you know if there is a solution for dynamic url using ACF?  (We have a frontend post creation form where we'd like users to be able to input a URL into a custom field. We currently have a video player working this way and hoping to replicate with the Sonaar player).

    Cheers! 

  •  1,103
    Max replied

    Im not familiar with frontend post creation form.

    you can perhaps built your shortcode dynamically instead of using the Elementor MP3 audio Widget. 

    See shortcode and attributes here: https://sonaar.ticksy.com/article/15282/

    Thanks,


    Max from the Sonaar.io Crew

  • Nils replied

    Hi Max,

    Thanks. I have tried the shortcode option. The player displays, but I couldn't get it to play audio. Can I double check the code with you? My ACF custom field for the URL is: audio_link

    Shortcode is:

    [sonaar_audioplayer feed="audio_link" sticky_player="true" hide_artwork="false" show_playlist="false" show_track_market="false" show_album_market="false"]

    Is this written correctly? If so, any ideas why it doesn't play music?

    Thank you.

  •  1,103
    Max replied

    If you use feed="audio_link" (between double quotes), audio_link is recognized as a string and not a acf field.

    you need to find a way with how you generate the shortcode, to bring the correct audio link.

    In Elementor Pro, I would use the shortcode with dynamic fields. 

    Something similar like this: https://d.pr/i/2QzFM0

    before: [sonaar_audioplayer feed="

    after: " sticky_player="true" hide_artwork="false" show_playlist="false" show_track_market="false" show_album_market="false"]


    hope this help

    Thanks,


    Max from the Sonaar.io Crew

  • Nils replied

    Max, you are a legend. Fixed. Thank you!

  •  1,103
    Max replied

    You are welcome 

    Thanks,


    Max from the Sonaar.io Crew

  • Nils replied

    Hi again Max. If I create a new custom field also for Track title, is it possible to make it appear in the player using this shortcode/dynamic field method? It just says 'Track 1'. I'd like the user to be able to enter a track title in the same way they enter the url.

    Thank you.

  •  1,103
    Max replied

    Hi,

    Currently not possible but I've kisdt revisited our code to accept more ACF fields into our shortcode attributes.

    Could you please provide me access to your wp-admin and I will install the updated and give you instruction on how to use it. it will be much easier.

    Thanks,


    Max from the Sonaar.io Crew

  •   Nils replied privately
  •  1,103
    Max replied

    Alright, I have installed the update. Its gonna work a little bit differently, but easier, than what I have explained before.

    Now:

    Simply create a shortcode. (i replaced it on your theme builder / single template)

    [sonaar_audioplayer feed="acf_audiolink" feed_title="acf_audiotitle" sticky_player="true" hide_artwork="false" show_playlist="false" show_track_market="false" show_album_market="false"]

    The only think you have to do is to rename your ACF field name to acf_audiolink and acf_audiotitle

    It's very important that you ACF field name BEGIN with acf_

    eg: you will have to rename your field audiolink to acf_audiolink




    Thanks,


    Max from the Sonaar.io Crew

  • Nils replied

    Hi Max,

    Thanks very much for doing this. All works well! Much appreciated :)


  •  1,103
    Max replied

    Awesome! Happy we could help you out! Btw. If you have a moment, I would very much appreciate if you could quickly rate our theme 5 Stars, just to help me spread the word. It's my little reward to offer great support to yousmile.png

    Simply click here https://www.trustpilot.com/evaluate/sonaar.io, hit 5 stars and you're done.

    Thank you so much! I appreciate !!

    Thanks,


    Max from the Sonaar.io Crew