WordPress.org

Ready to get started?Download WordPress

Forums

KC Settings
Storing json object for js charts? (4 posts)

  1. son0fhobs
    Member
    Posted 2 years ago #

    Greetings!

    KC Settings is an absolutely phenomenal plugin and my favorite options framework by far! Thank you!

    I'm still trying to figure out the best method to do this, and it may not be using kc settings, even though I'm already using it on the site for other things.

    I'm trying to store mulitidimensional arrays as post metadata. There's an option for multiple input which is superb as the length of the array is variable. It's exactly what I'm looking for except now all I need is the ability to nest values into a multidimensional array.

    Although I can add entries as needed in the options framework settings, then work with them in the editing post section, I'd like to be able to modify them all in the edit post section. The number of values will be different per post, and if I'm setting this up for others to use.

    I'm thinking that I'd need to hack the code, but not sure the best method. Any chance you could point me in the right direction? Or should I use another plugin/framework?

    Thank you!

    http://wordpress.org/extend/plugins/kc-settings/

  2. Dzikri Aziz
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,

    Thank you for using KC Settings.

    I think your best option is to use the 'special' field type and create a custom function as the callback to handle the form fields. I do this all the time for my freelance work when the available field types can't handle my needs.

    The arguments passed to the callback function should be more than enough for you to fiddle with, and feel free to let me know if you need help.

  3. son0fhobs
    Member
    Posted 2 years ago #

    Hey Dzikri Aziz,

    Thanks for the quick reply! That's a very good point. I'm not terribly adept with that function, but wouldn't that mean basically creating your own input form? And if yes, does that require you to store it yourself with update_metadata()?

    I guess what I'm saying is, do you think you could throw up an example of how you use it to get me up and running a lot quicker?

    I apologize if some of my questions/interpretations aren't terribly knowledgeable. I don't have the code in front of me, or the time to dig into it at the moment. But I'll definitely work on it tomorrow. And example would help jump start me into things. Thanks!

  4. Dzikri Aziz
    Member
    Plugin Author

    Posted 2 years ago #

    No, you don't need to do the updating part, the plugin will handle this for you :) All you have to do is display the fields based on the values you get from the arguments passed to your callback functions.

    For the example, take a look at functions kc_sample_callback_* in the sample file kc-settings/kc-settings-inc/doc/sample/01_plugin.php

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic