Customizing Themes with Conditionals, Child Themes & Plugins

The Theme Customizer Boilerplate is an excellent tool for handling theme options, and its hooks make it easy to use. To get started, you need to hook into the ‘thsp_cbp_options_array’ filter hook and pass an array of options that you want to use in your theme. WordPress action and filter hooks, also known as the Plugin API, are essential tools for developers. The priority argument is a crucial aspect of hooks, and its default value is 10. If you do not use another number, that’s what your function’s execution priority will be. Lower the number, earlier your function is executed.

You can use the Theme Customizer Boilerplate to add new sections to your theme. For example, you can add a new section called ‘New Section’ with a radio button field called ‘My Radio Button.’ You can also develop a child theme for your theme and decide to keep the ‘New Section’ but replace the radio button field with a checkbox field called ‘My Checkbox.’ You can hook into the ‘thsp_cbp_options_array’ filter hook from your parent theme more than once.

It’s essential to keep WordPress’ core principle of ‘Decision not Options’ in mind when adding options to your theme. It’s easy to get carried away and start adding user options for every minor detail your theme has, but that’s not doing anyone a favor. Adding plugin-dependent options is an excellent way to keep your theme’s options count as low as possible. If your theme has options for every border radius of every single element, it’s not a theme; it’s a WYSIWYG editor and probably not a great one.

As a theme developer, it’s your job to make sure user expectations are what they should be. WordPress themes should present content in a certain way, not try to do everything in every way imaginable. Just like you don’t buy a white shirt because with some extra effort, you can transform it into a table cloth, you buy it because you like its “whiteshirtness.” Your WordPress theme should be like that too.

Stay in Touch


Related Articles