Never Fear, The Customizer Is Here!
Last month I gave my first WordCamp presentation at WordCamp Sunshine Coast.
WordCamp Sunshine Coast 2016 was the first time the Sunshine Coast had hosted a WordCamp, and the third region in Queensland so far after the Gold Coast and Brisbane.
It was a wonderful experience to stand alongside so many people I look up to and admire within the WordPress community. We are really blessed with so many amazing contributors to WordPress here in Australia.
It was incredibly humbling to be contacted by Weston Ruter, the lead developer of the Customizer, following my presentation. I had a lot of encouragement and support from a number of the XWP team which was very much appreciated.
The recording of the session doesn’t look like it’ll be uploaded any time soon, but if it does I’ll update this post to include it.
Have a question about the Customizer? Drop me a line in the comments and I’ll see what I can do!
The code used in the demo is available on GitHub: https://github.com/cameronjonesweb/wordcampsc
Register a function to manage your Customizer settings
Create a setting that changes the colour of the links
The setting is now registered, but we can’t interact with it until without a control. A control creates the interface to change the setting. In this instance we want a colour picker
Create a control to manage the setting
It won’t update unless we tell it how to
Update in the live preview
Some people will still be running < 4.5 (and should upgrade) but need to be catered for
That’s everything for managing the setting, but we still need to actually output the styles.
Display the style tag in the head for us to target with our Customizer styles
We’re using the code to output the style twice
Let’s move that into it’s own function for consistency and to remain DRY.