When you create a panel you do something like this:
Kirki::add_panel( 'panel_id', array(
'priority' => 10,
'title' => esc_attr__( 'My Panel', 'textdomain' ),
'description' => esc_attr__( 'My panel description', 'textdomain' ),
) );
If you want it nested inside another panel, you’d simply add 'panel' => 'parent_panel_id'
.
Note though that a panel without sections will not appear. So you must have at least 1 section in the paren panel as well.
Similarly, you can nest a section inside another section simply by adding to the child section 'section' => 'parent_section_id'
.
But again, a section without controls will not work, so you should have at leat 1 control in the parent section.
However just a personal note:
I added those features because they were highly requested. But I don’t believe they should be really used… If a theme’s settings are so many and so confusing in hierarchy that they require nesting in more than 2 levels (panel & section) then there’s something wrong with the way the theme is designed or structured.
In theory the nested panels & sections will allow you to do something like this:
Panel
|---Section
|---|---Settings
|---Section
|---|---Settings
|---|---Sub-Section
|---|---|---Settings
|---Sub-Panel
|---|---Section
|---|---|---Settings
|---|---Section
|---|---|---Settings
|---|---|---Sub-Section
|---|---|---|---Settings
However that will be extremely confusing & counter-intuitive for users no matter how well it’s organized.
In short: Yes, you can nest panels and sections with Kirki. But please try not to.. ??