Follow us on
  1. Hi,
    I need to show Checkbox group list. Loop data will come from get_option().
    I'm struggling to find out the solution how I can create such kind of settings.
    https://prnt.sc/10wt7n3

    Posted 2 years ago #

  2. Codestar
    Admin

    Hi,

    If I understand right, you need this:

    // config array
    array(
      'id'      => 'opt-checkbox-1',
      'type'    => 'checkbox',
      'title'   => 'Checkboxes',
      'options' => 'prefix_get_something', // a custom function callback
    ),CopyCopied!
    // your custom utils functions
    function prefix_get_something() {
    
      $somethings = get_option( 'somethings' );
    
      // make array output like this:
    
      return array(
        'opt-1' => 'Option 1',
        'opt-2' => 'Option 2',
        'opt-3' => 'Option 3',
      );
    
    }CopyCopied!

    This method can be used in radio, checkbox, select as well. ( See also: http://codestarframework.com/documentation/#/fields?id=checkbox Config Examples -> WP Query Options )

    Regards, Codestar

    Posted 2 years ago #
  3. Hi,
    There's no reason to separate options with a callback function. I need to run a loop with index values.
    Here's an example I've created by editing HTML: https://prnt.sc/10x1nne
    Hope it help you to understand better.

    Thanks

    Posted 2 years ago #
  4. I've made the solution myself.
    Thanks a lot

    Posted 2 years ago #

  5. Codestar
    Admin

    Well done

    Posted 2 years ago #