When you create a project in Kirki, the first thing you have to do is create a configuration. Configurations allow each project to use a different setup and act as identifiers so it’s important you create one. Fields that belong to your configuration will inherit your config properties.
Kirki::add_config( $config_id, $args );
Example:
Kirki::add_config( 'theme_config_id', array(
'capability' => 'edit_theme_options',
'option_type' => 'theme_mod',
) );
Arguments
capability
: any valid WordPress capability. See the WordPress Codex for details.option_type
: can be eitheroption
ortheme_mod
. We recommend usingtheme_mod
. If however you choose to useoption
you need to understand how your data will be saved, and in most cases you will also have to use theoption_name
argument as well.option_name
: If you’re using options instead of theme mods then you can use this to specify an option name. All your fields will then be saved as an array under that option in the WordPress database.disable_output
: Set totrue
if you don’t want Kirki to automatically output any CSS for your config (defaults tofalse
).
To create a field that will then use this configuration you can add your fields like this:
Kirki::add_field( 'theme_config_id', $field_args );