If you are building a WordPress theme that will be distributed (either free or premium), the first thing you have to decide when using Kirki is how your clients will get the plugin on your site.
Currently there are 2 options:
- Recommend (or require) the installation of Kirki as a plugin
- Embed Kirki in your theme.
Use a 3rd-party script to require/recommend the installation of Kirki
Use a custom script to recommend the installation of Kirki
If you donâ€™t use one of the above scripts, then you can include this simple script in your theme to recommend the installation of Kirki from inside the customizer.
Copy the file from here to your theme (for example in
mytheme/inc/class-kirki-installer-section.php), and then in your
functions.php file add this:
include_once get_theme_file_path( 'inc/class-kirki-installer-section.php' );
A word of caution for themes on wordpress.org:
If your theme will be distributed via wordpress.org you cannot require the installation of plugins but you can recommend them. That means that the theme will still have to work when kirki is not installed, for which we have already build a fallback PHP Class you can use in your themes here.
Embed in your theme
Though we do do not recommend embedding kirki in your theme it is still possible to do. You can simply copy the plugin in your theme and then include the main plugin file in your themeâ€™s
Keep in mind that if you choose to follow this method Kirki will be â€œinvisibleâ€ as a plugin to your clients and they will therefore be unable to update to future versions in case of bugfixes and/or security updates.