Site icon Hip-Hop Website Design and Development

The right way to save theme customizer values as sub-array?

I created a customized management cluster for the theme customizer which incorporates radio enter and textarea. I wish to save the info as sub-array, as in array( key => array() )

The knowledge attribute data-customize-setting-link="fieldname" is ready for the radio, however clearly I am unable to use the identical identify for the textarea so as to add as sub array. I attempted the json array technique as achieved with identify="fieldname[val]" attribute however that doesn’t work.

Utilizing class extension

class MyCustomControl extends WP_Customize_Control
{}

Output fields

To save lots of bot fields I’ve to make use of completely different knowledge attribute names, and the next is the saved worth.

Array
(
    [custom_css_post_id] => -1
    [nav_menu_locations] => Array
        (
            [primary] => 20
        )

    [theme] => black-on-white.css
    [customcss] => physique {font-family: arial;}
)

What I want

The info ought to be saved because the nav_menu_locations does.

array(
 [theme] => array(
  [themecss] => black-on-white.css
  [customcss] => physique {}
 )
)

Replace

The issue has been resolved