Okay
  Public Ticket #2818092
How to work with the plugin data programmatically ?
Closed

Comments

  • Julien G started the conversation

    I've conducted a lot of tests to work with the plugin.
    I wondered if you had some info/documentation to give about how to work programmatically with the plugin. For example to "autofill" the local post tracklist ("play own post ID track") with files/urls stored in custom fields?

    Simply put: if I have an existing website with lots of posts which have each one or multiple audio files attached (info stored in meta) and want to add the  tracklist content without manually going through each and every post, and add the player in a theme template, how should I go about it?

    Does the shortcode have options I can use to enable for example from the template the "play own post ID track list"?

    How can I pass info to the player from the meta? 

    I can see "alb_tracklist" "alb_release_date" or

    "sonaar_footer_player_shuffle_meta" in the database meta associated with a post, how do I work with it? To push a tracklist for example?

    Any info would be good to take, I did not find articles in the ticksy that helped about those.

    Thanks a lot in advance.

  •  529
    Max replied

    Hi, 


    1) You can use our shortcode and our "feed" attribute to set your own mp3 url. 

    Please read this article to see all shortcodes attributes https://sonaar.ticksy.com/article/15282


    2) you could use ACF to dynamically add your mp3 feed attribute. More info here

    https://sonaar.ticksy.com/article/17004/

    Hope it helps.


    Thanks,


    Max from the Sonaar.io Crew

  • Julien G replied

    I'll conduct tests with the information you provided me to see if I can achieve what I'm planning. 

    Thanks for the answer.

  • Julien G replied

    Hi @max,

    I'm reopenning this issue as I have identified what is my issue.

    I'm trying to write a function to create post playlists (posts would use their own tracklist). I can't do it by hand because I'm working on transitioning an old website with more that 5000 mp3 files to use your plugin, with which I'm very satisfied for now by the way.

    What I would like you to guide me with is what methods can I use to do that through a function. I can see in the wp_postmeta table that the info is stored in alb_tracklist. Is there a good way to do that?

    My idea is that my function will parse a data file and add a list of mp3 external urls each and corresponding track titles. Each post would have a list of this kind. Now does the plugin have a function like addtrack() or whatever that I should use or should I write everything from the ground up?

  •  529
    Max replied

    alb_tracklist is our CMB2 metadata field where we store track info.

    we don't have any specific functions to add, remove, edit tracks..everything is done using https://cmb2.io/ custom fields within a Wordpress custom post type.


    Thanks,


    Max from the Sonaar.io Crew

  • Julien G replied

    I'll look into CMB2 then. So for the in-post tracklists it's only a CMB2 custom field added to the "post" post type? 

  •  529
    Max replied

    to the album post type.

    Thanks,


    Max from the Sonaar.io Crew