While working on the next version of Techozoic Fluid I’ve been incorporating the new theme customizer features of WordPress 3.4. Currently Techozoic uses the Options Framework from Devin Price to handle all the settings pages. The framework is awesome and saves developers tons of time implementing the settings api. As always Devin already had a great tutorial on using the customizer with the framework. He went over all the basics of getting it working together. However with Techozoic there are many options and including them in the customizer by hand would have been a huge job. So I came up with this simple loop to accomplish the job of getting all the options into the customizer.
After following all the directions from Devin about changing the options array to used named keys then this loop will come into play. I’ll go over the basics of what the loop does. First of all you’ll need to replace all instances of theme_slug with your own theme’s slug. The $customizer_array is where it starts this array setups your option sections and which options will be displayed in each section. The sample array is broken down into two sub arrays the key of these being the section id used for the customizer sections, this will produce two sections. Under each of these is some info about the section itself name is the title of the section, localized in this example, and priority is where in the customizer list the section will show up. Next is the settings key which is an array itself of option ids that you setup early following Devin’s tutorial.
Now on to the loop itself, basically this will loop over each section and then loop over each settings array in that section. Then it will use the appropriate way of adding the option to the customizer, since the different option types require slightly different way of adding them to the customizer. Currently only checkbox, radio, text, select, color, and image option types are supported. While extending the customizer is entirely possible it’s beyond this guide.

By Jason Loftis November 30, 2012 - 5:49 pm
This works great on WordPress 3.4.2. But I just tried it with WordPress 3.5 Release Candidate 2, and it doesn’t work. Only the default option sections show up in the customizer and none specified by your code’s loop are available. I can’t find any documentation on WP 3.5′s changes to the Theme Customizer API, so I’m not sure where the incompatibility is. Any ideas?
By Jeremy Clark November 30, 2012 - 5:53 pm
I actually wrote this on 3.5 RC1 and I’ve tested it with 3.5 RC2 and it works in my theme. I’ll double check the code and make I didn’t miss anything.
By Jason Loftis November 30, 2012 - 7:27 pm
Thanks for the reply. Good to know that it worked for you. Perplexing that my experience is different. Not sure what to attribute that to. If it didn’t work with 3.4.2, then it would be obvious that I’m doing something wrong. I’m stumped for now. I’ll let you know if I figure out what the issue is on my end.
By Jason Loftis December 3, 2012 - 9:04 pm
Jeremy, I figured out the problem I was having. In my functions file I registered a nav menu that I left blank in the actual menu options panel… meaning I hadn’t gotten around to defining nav items for it. Once I added nav items to the menu (or deleted the menu’s registration), everything worked fine again. It’s interesting that 3.4.2 doesn’t flake out over the blank menu, but 3.5 does.
By Jeremy Clark December 5, 2012 - 8:27 am
Glad you figured it out, that is strange it bombing in the latest version but not 3.4.