Viewing 3 replies - 1 through 3 (of 3 total)
  • 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.. ??

    Thread Starter ThemeAWESOME

    (@tsquez)

    Hi there,

    The reason I asked this question is that I used this: https://gist.github.com/OriginalEXE/9a6183e09f4cae2f30b006232bb154af to create nested panels for my TotalPress theme.

    And yes I understand your reasoning about using sub panels and the like, however they can be very helpful when done correctly.

    However that will be extremely confusing & counter-intuitive for users no matter how well it’s organized.

    That all depends on the end user amigo, always has, always will. Even the most simple of things can be an extremely difficult challenge to some. It just depends. As a developer you should know this.

    Thanks for the info, I greatly appreciate it ??

    Oh I agree 100% that it’s up to the user.. all I’m saying is that my personal opinion is that themes should try and follow the WordPress Core Philosophy of “decisions, not options”. I have found it to be one of the most important ones to follow in my own projects. Again this is just a personal preference.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Nested Panels?’ is closed to new replies.