kirki

Kirki Toolkit: A complete toolkit for WordPress Theme Developers

We’re going to go through Kirki Toolkit, a great Customizer toolkit for WordPress theme developers. Using Kirki theme developers can create rich experiences for the WordPress Customizer using best coding practices.

Theme Customization API

WordPress version 3.4 introduced a new API called the Theme Customization API and the “Theme Customizer” screen. It allows us to add customization options in the Appearance > Customize menu, with an opportunity to change theme settings simultaneously while previewing the website.

Developing theme options using the Customizer API, while being a straightforward and logical process, involves writing a certain amount of repetitive code.  To cut down on some of the steps required to build a functioning and safe Customizer options, Aristeides Stathopoulos has been developing a free and open-source plugin, Kirki.

It didn’t create much hype at first, but the community adopted it over time, and we gradually got more and more excited about this handy API. Over two years after its release, the Customizer API has evolved into a wonderful utility that even lets us publish posts and customize the login screen.

It’s not an overstatement to say that Customizer is one of the most valuable APIs of WordPress because of its ability to completely change users’ experience.

Also Read: 9 Amazing Tools to Up Your Digital Marketing Game

What is Kirki?Kirki Toolkit

Kirki is a great tool to improve the experience of a theme’s users. It focuses solely on theme customization and extends the default Customizer controls with toggles, range inputs and images as radio buttons.

Let’s hear what Kirki Toolkit is about from the developer behind it:

Kirki is not a framework. It’s a toolkit allowing WordPress developers to use the Customizer and take advantage of its advanced features and flexibility by abstracting the code and making it easier for everyone to create beautiful and meaningful user experiences.

Once you get to know how it works, building a theme customization screen will be easier than ever.

A Call to Action: Kirki is translation-ready and needs your help to translate this open-source project into different languages.

You can install the Kirki as a plugin form the WordPress plugin directory. If you are a developer and want to add the Kirki in your theme or plugin, you can download the Kirki plugin and put it in your theme folder. After extracting the plugin file put the Kirki folder with all files anywhere in your theme directory.

Currently, there are 2 options:

  1. Recommend (or require) the installation of Kirki as a plugin
  2. Embed Kirki in your theme.

If you are using TGMPA or MerlinWP in your theme, then you can use those to recommend – or require – the installation of the Kirki plugin with your theme.

You can include this simple script in your theme to recommend the installation of Kirki from inside the customizer.

Usage:

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' );

Kirki extends the default control fields list with new ones. For the sake of writing a more “complete” tutorial, I will include the core control fields as well as Kirki’s additional control fields.

  1. text-allows you to add a simple text input.
  2. textarea -allows you to add a text area.
  3. editor -allows you to add a WYSIWYG editor.
  4. radio -allows you to add radio buttons.
  5. checkbox -allows you to add checkboxes.
  6. color and color-alpha (supports transparency) -allow you to select a color with a nice color picker.
  7. background -allows you to add a complete CSS background customizer.
  8. palette -allows you to add a color palette.
  9. select -allows you to add a dropdown menu.
  10. select2 -allows you to add a “better” selection menu, different from the default <option> HTML element.
  11. select2-multiple -allows you to add a selection menu with multiple choices. (Wild guess: This might be merged with the select2 field in the future.)
  12. dropdown-pages -allows you to add a dropdown menu listing the pages in the database.
  13. upload -allows you to add the native uploader.
  14. image -allows you to add the native image selector/uploader.
  15. radio-image -allows you to add images acting as radio buttons.
  16. radio-buttonset -allows you to add a button set acting as radio buttons.
  17. number -allows you to add an HTML5 number input.
  18. slider -allows you to add an HTML5 range slider.
  19. multicheck -allows you to add a list with multiple checkbox inputs.
  20. switch -allows you to add a “switch” button that acts like a checkbox, but prettier.
  21. toggle -allows you to add a “toggle” button that also acts like a checkbox.
  22. sortable -allows you to add a sortable list of checkbox controls.
  23. custom -allows you to add a custom control field, which is basically any valid HTML code fragment.

Also Read: Highly Recommended WordPress Page Builder Plugins

Kirki has some pretty cool settings for you to make a customized Customizer for your theme. You can display a logo above the control fields, set a different color scheme for the Customizer and so on.

  • logo_image: Specifies the logo image URL.
  • description: Specifies a description text that will be displayed upon clicking the logo.
  • color_active: Specifies the “active” color for menu items, help buttons and such.
  • color_light: Specifies the “secondary” color for disabled and inactive controls.
  • color_select: Specifies the “selected” color for, well, selected stuff.
  • color_accent: Specifies the “accent” color that’s used on slider controls and image selects.
  • color_back: Specifies the background color for the Customizer.
  • url_path: Specifies the URL path for Kirki, used for loading CSS files in its /assets/ folder.
  • stylesheet_id: The stylesheet ID to set as the handle in CSS enqueueing processes.

To set these style options, you will need to use the kirki/config filter.

Resources

Here are some great resources.

Wrapping up

Kirki is actively being developed and supported. Its API and customs control already significantly optimize the time it takes to develop Customizer theme options. This becomes especially important if you’re looking to have your theme listed in the WordPress.org themes repository. In fact, themes that provide customization options are required to do so via the Customizer rather than custom options pages.

What do you think about Kirki? Shoot your thoughts in the Comments section below. And if you liked the article, don’t forget to share it with your friends!

Comments are closed.

Welcome to Wbcom Designs!  - Get 10% off on all plugins & themes
Coupon : HELLO10