Customize component has an incredible PHP and JS based API in the WordPress Core. I found it to be much better than many other elements e.g. the Settings API in WordPress is a bit messy (probably why Scott Clark from 10Up is building the Fields API).
In the case of these frameworks, it quickly became hard to deal with the updates, backward compatibility, and then code quality especially concerning security. I found myself reading more and more source code to keep up with their development. And then came a time when I felt I should probably go as native as I can to use WordPress APIs instead of such frameworks.
I started to figure out what kept me away from using the official WP Customizer API. I found out that WP Customizer is not very commonly adopted because of the lack of enough documented examples. Because after going through both Codex and Dev Reference, basic concepts of WordPress customizer were mundanely clear. It was just that the information is so scattered that I always went for simple and to the point frameworks.
Stupid-simple, tab-triggered sublime snippets and completions for WordPress Customizer.
I’ve been a big fan of Sublime Text; I use it every day for both frontend and backend programming. Sublime Text has a great deal of potential which helps me automate my dev workflow and build small completions and snippets based libraries.
What if I told you that you can build Customizer options for your next WordPress product (theme/plugin) under 5 minutes? Yes, it is possible! I have made a Sublime Text package for WordPress Customizer that can help you write quality code in a jiffy.
You can do a fuzzy search inside PHP or JS file with initials of the snippets’ names. E.g. To add a WP Customizer Add Pannel you can just type wpcap and Sublime will suggest the snippet. If that doesn’t happen, read the optional tip below. You can also open Package Control’s Command Pallet: Command+Shift+P on Mac Ctrl+Shift+P on Windows or Linux and search for these snippets.
How to use the snippets?
WP Customize snippets are meant to bring ease to your workflow. All you have to do is select a snippet and then press tab button to go from one editable area to another. E.g.
Sublime won’t autocomplete in the PHP files when there is no closing ?> tag, so go to Sublime Text > Preferences > Settings-User add this snippet:
Restart Sublime Text to complete the installation. The features listed above should now be available.
Understand manual installation.
You can manually install by cloning this repository into your Sublime Text Packages directory. Get to it quickly from within Sublime via the menu at Sublime Text > Preferences > Browse Packages.
So, browse the Packages directory in terminal and clone this repository inside it by running the following command.
Last I checked, WordPress Customizer package for Sublime was 32nd most trending Sublime Package with about 250 downloads in just about two weeks. It’s up to you now. I think if you use Sublime do give it a try. If you run into any issues, create a new issue at GitHub or send a Pull Request. If you have any questions comment below. Or reach out to me at Twitter @mrahmadawais.