I was very excited in 3.4 to see the Theme Customization come about, and have read a ton of stuff about it (including the OttoPress posts). I wrote a bunch of customizations for my theme, which will greatly add to the functionality and remove the need for most people to write any CSS or PHP at all. However, when I started testing it out on installs that had never set the specific theme mods before (I'm using theme_mod
instead of option
), I realized that the defaults I defined in the add_setting
statement were not getting used at all. (I know that I could define the default directly in the get_theme_mod( 'modname', mydefaultvalue);
but that defeats the purpose of defining the default in the add_setting
.
I just re-read the Theme Customization API documentation in the codex, and noticed something in one of Otto's comments I hadn't noticed again. Next to one of the defaults defined in his add_setting example it says "//Default setting/value to save".
This makes me think that I've been misunderstanding completely how the default works. Should this be passed to get_theme_mod( 'somemod');
if somemod isn't set in the theme mods, or is it just the default value that will be saved if ome saves the theme customizer without entering a value? (I'm hoping that the default value will be used if somemod isn't saved in the database, but a default is defined in the add_setting, so the default will work even before they save the Theme Customizer.)
Do I just need to pass the default during each get_theme_mod
call, even though it's defined in the add_setting
?