<p dir="ltr">Inside the callback where you wxtend the customizer, call $defaults = themeslug_get_defaults();</p>
<p dir="ltr">Then, just pluck the value out of the array, based on the key.</p>
<div class="gmail_quote">On May 22, 2014 10:22 PM, "Thomas Usborne" <<a href="mailto:hello@edge22.com">hello@edge22.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-CA" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">That would be ideal – forgive my ignorance but how would I go about doing that?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Tom<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> theme-reviewers [mailto:<a href="mailto:theme-reviewers-bounces@lists.wordpress.org" target="_blank">theme-reviewers-bounces@lists.wordpress.org</a>] <b>On Behalf Of </b>Chip Bennett<br>
<b>Sent:</b> Thursday, May 22, 2014 7:19 PM<br><b>To:</b> [theme-reviewers]<br><b>Subject:</b> Re: [theme-reviewers] Child theme question<u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><p>Instead of using a static atring, why not pass the correlating value fron the defaults array?<u></u><u></u></p>
<div><p class="MsoNormal">On May 22, 2014 10:14 PM, "Thomas Usborne" <<a href="mailto:hello@edge22.com" target="_blank">hello@edge22.com</a>> wrote:<u></u><u></u></p><div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">They're using the 'default' argument in the add_setting function:</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">// Add Header Layout setting</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">$wp_customize->add_setting(</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> // ID</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 'generate_settings[header_layout_setting]',</span><u></u><u></u></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> // Arguments array</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> array(</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 'default' => 'fluid-header',</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> 'type' => 'option'</span><u></u><u></u></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> )</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">);</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Using add_filter, the new options took place while viewing the live site, but when I went into the Customizer, the default argument above was overriding the filtered defaults.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Tom</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> theme-reviewers [mailto:<a href="mailto:theme-reviewers-bounces@lists.wordpress.org" target="_blank">theme-reviewers-bounces@lists.wordpress.org</a>] <b>On Behalf Of </b>Chip Bennett<br>
<b>Sent:</b> Thursday, May 22, 2014 7:07 PM<br><b>To:</b> [theme-reviewers]<br><b>Subject:</b> Re: [theme-reviewers] Child theme question</span><u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p>Why isn't the customizer using the defined/filterable defaults in the parent theme?<u></u><u></u></p>
<div><p class="MsoNormal">On May 22, 2014 10:04 PM, "Thomas Usborne" <<a href="mailto:hello@edge22.com" target="_blank">hello@edge22.com</a>> wrote:<u></u><u></u></p><div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">So I went ahead and tried using filters, and while it worked on the live site, it didn't work while in the Customize screen, as those options are using the defaults set in the customizer.php file.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">However, would this be acceptable?</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><a href="https://gist.github.com/proframework/2100e308050c3aa00a94" target="_blank">https://gist.github.com/proframework/2100e308050c3aa00a94</a> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Of course I could do it without the admin notice, but I think giving the user an option to import the child theme settings is a good idea in case they make changes to the child theme and don't want to lose those changes if another theme is activated and they switch back.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks!</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Tom</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> theme-reviewers [mailto:<a href="mailto:theme-reviewers-bounces@lists.wordpress.org" target="_blank">theme-reviewers-bounces@lists.wordpress.org</a>] <b>On Behalf Of </b>Simon Prosser<br>
<b>Sent:</b> Thursday, May 22, 2014 6:06 PM<br><b>To:</b> Discussion list for WordPress theme reviewers.<br><b>Subject:</b> Re: [theme-reviewers] Child theme question</span><u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p>
<div><p class="MsoNormal">file_get_contents == badness. And anyway file_get_contents with a remote url would be banned on just about every shared host out there.<u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12.0pt">
<u></u><u></u></p><div><p class="MsoNormal">On 23 May 2014 01:58, Chip Bennett <<a href="mailto:chip@chipbennett.net" target="_blank">chip@chipbennett.net</a>> wrote:<u></u><u></u></p><p>Given that you should have only one single option (wp_options db entry), I don't think that gist would be the way to go.<u></u><u></u></p>
<div><div><div><p class="MsoNormal">On May 22, 2014 8:46 PM, "Thomas Usborne" <<a href="mailto:hello@edge22.com" target="_blank">hello@edge22.com</a>> wrote:<u></u><u></u></p><div><div><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks for the info – that definitely looks like the best way to go about it.</span><u></u><u></u></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Alternatively, would something like this be acceptable?</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><a href="https://gist.github.com/proframework/a37e928462f72d674fd2" target="_blank">https://gist.github.com/proframework/a37e928462f72d674fd2</a> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks again for all the help – I really appreciate it.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Tom</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> theme-reviewers [mailto:<a href="mailto:theme-reviewers-bounces@lists.wordpress.org" target="_blank">theme-reviewers-bounces@lists.wordpress.org</a>] <b>On Behalf Of </b>Chip Bennett<br>
<b>Sent:</b> Thursday, May 22, 2014 5:10 PM<br><b>To:</b> [theme-reviewers]<br><b>Subject:</b> Re: [theme-reviewers] Child theme question</span><u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p>The parent theme will define defaults for each option. Put the defaults in an array, wrap it in a function (eg themeslug_get_defaults ()), and then pass the returned output through a custom filter. For example:<u></u><u></u></p>
<p>function themeslug_get_defaults () {<br> $defaults = array( // values here );<br> return apply_filters ( 'themeslug_option_defaults', $defaults );<br>}<u></u><u></u></p><p>Then, you can just add a filter in the child theme.<u></u><u></u></p>
<div><p class="MsoNormal">On May 22, 2014 7:02 PM, "Thomas Usborne" <<a href="mailto:hello@edge22.com" target="_blank">hello@edge22.com</a>> wrote:<u></u><u></u></p><div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks for getting back to me.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Sorry for not being more specific.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The options are already present in the parent theme – so the child theme won't necessarily be adding more options to the customize panel.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The child theme will simply be changing some of the pre-existing parent theme options (sidebar layout for example).</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">On theme activation I know I can import settings from a .json file, but wanted to know if this was frowned upon for some reason?</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I wouldn't want to automatically import the .json file in case they made changes, changed themes and changed back – wouldn't want to overwrite their options. However, I could add a notice of some sort with a link to initiate the import of settings from the .json file.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks again!</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Tom</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> theme-reviewers [mailto:<a href="mailto:theme-reviewers-bounces@lists.wordpress.org" target="_blank">theme-reviewers-bounces@lists.wordpress.org</a>] <b>On Behalf Of </b>Otto<br>
<b>Sent:</b> Thursday, May 22, 2014 3:55 PM<br><b>To:</b> Discussion list for WordPress theme reviewers.<br><b>Subject:</b> Re: [theme-reviewers] Child theme question</span><u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p>
<div><p class="MsoNormal">Hard to say without more specific details. But the easy way is for the parent theme to be expandable through the use of actions and filters.<u></u><u></u></p><div><p class="MsoNormal"> <u></u><u></u></p>
</div><div><p class="MsoNormal">So for example, in the parent, in the function where it's adding the customize stuff, you could do_action('themename_customize_whatever'); and then the child could add it's own function to do more stuff, and hook it into that action.<u></u><u></u></p>
</div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Same for any settings or options or arrays of "stuff". Run them through an apply_filters call in the parent, and then the child can use that to modify them before they make it wherever they're going.<u></u><u></u></p>
</div><div><p class="MsoNormal"> <u></u><u></u></p></div></div><div><p class="MsoNormal"><br clear="all"><u></u><u></u></p><div><p class="MsoNormal">-Otto<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">
<u></u><u></u></p><div><p class="MsoNormal">On Thu, May 22, 2014 at 5:34 PM, Thomas Usborne <<a href="mailto:hello@edge22.com" target="_blank">hello@edge22.com</a>> wrote:<u></u><u></u></p><div><div><p class="MsoNormal">
Hi everyone, hope I'm doing this right!<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">I recently had my first theme added to WordPress.org.<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I now want to begin releasing some child themes for it, but have a question about how to go about doing that.<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">The child themes will obviously have some CSS etc.. but it will also have some options changed in the "Customize" section of the parent theme.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Would it be acceptible to display a message to the user upon activation which would allow them to click a link to import some of the options into the parent theme?<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">If not, what's the best way for me to go about this?<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Thanks!<u></u><u></u></p>
<p class="MsoNormal">Tom<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>_______________________________________________<br>theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br><a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><u></u><u></u></p>
</div><p class="MsoNormal"> <u></u><u></u></p></div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>_______________________________________________<br>theme-reviewers mailing list<br><a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><u></u><u></u></p></div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt">
<br>_______________________________________________<br>theme-reviewers mailing list<br><a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br><a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><u></u><u></u></p>
</div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>_______________________________________________<br>theme-reviewers mailing list<br><a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><u></u><u></u></p></div><p class="MsoNormal"><br><br clear="all"><u></u><u></u></p>
<div><p class="MsoNormal"> <u></u><u></u></p></div><p class="MsoNormal">-- <br>My Blog: <a href="http://pross.org.uk/" target="_blank">http://pross.org.uk/</a><br>Plugins : <a href="http://pross.org.uk/plugins/" target="_blank">http://pross.org.uk/plugins/</a><br>
Themes: <a href="http://wordpress.org/extend/themes/profile/pross" target="_blank">http://wordpress.org/extend/themes/profile/pross</a> <u></u><u></u></p></div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt">
<br>_______________________________________________<br>theme-reviewers mailing list<br><a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br><a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><u></u><u></u></p>
</div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>_______________________________________________<br>theme-reviewers mailing list<br><a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><u></u><u></u></p></div></div></div><br>_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
<br></blockquote></div>