Roots Discourse

Sage 9 or 10 with Kirki Customizer

Hi everyone, I just want to ask if how to properly setup kirki customizer in sage 9 or 10 using namespace?

What problems are you having? If you’re running into issues with Namespacing, you might read our blog post on the subject: https://roots.io/namespacing-and-autoloading/

Thank you for this info it helps me a lot.

I used use Kirki and the error app/kirki class not found was gone and everything is working fine now. But I’m not sure if this is correct or not but its working.

namespace App;

use Kirki;

if(class_exists( 'Kirki' )){

  Kirki::add_config( 'sage_config', array(
    'capability'    => 'edit_theme_options',
    'option_type'   => 'theme_mod',
  ) );
  
  /**
   * Include files for panels, section & fields.
   */
  include 'customizer/fields-header.php' ;
  include 'customizer/fields-footer.php' ;
  include 'customizer/fields-sidebar.php';

}