[theme-reviewers] Child theme question
Chip Bennett
chip at chipbennett.net
Fri May 23 00:09:56 UTC 2014
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:
function themeslug_get_defaults () {
$defaults = array( // values here );
return apply_filters ( 'themeslug_option_defaults', $defaults );
}
Then, you can just add a filter in the child theme.
On May 22, 2014 7:02 PM, "Thomas Usborne" <hello at edge22.com> wrote:
> Thanks for getting back to me.
>
>
>
> Sorry for not being more specific.
>
>
>
> The options are already present in the parent theme – so the child theme
> won't necessarily be adding more options to the customize panel.
>
>
>
> The child theme will simply be changing some of the pre-existing parent
> theme options (sidebar layout for example).
>
>
>
> 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?
>
>
>
> 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.
>
>
>
> Thanks again!
>
> Tom
>
>
>
> *From:* theme-reviewers [mailto:
> theme-reviewers-bounces at lists.wordpress.org] *On Behalf Of *Otto
> *Sent:* Thursday, May 22, 2014 3:55 PM
> *To:* Discussion list for WordPress theme reviewers.
> *Subject:* Re: [theme-reviewers] Child theme question
>
>
>
> 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.
>
>
>
> 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.
>
>
>
> 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.
>
>
>
>
> -Otto
>
>
>
> On Thu, May 22, 2014 at 5:34 PM, Thomas Usborne <hello at edge22.com> wrote:
>
> Hi everyone, hope I'm doing this right!
>
>
>
> I recently had my first theme added to WordPress.org.
>
>
>
> I now want to begin releasing some child themes for it, but have a
> question about how to go about doing that.
>
>
>
> 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.
>
>
>
> 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?
>
>
>
> If not, what's the best way for me to go about this?
>
>
>
> Thanks!
>
> Tom
>
>
>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20140522/cf673788/attachment-0001.html>
More information about the theme-reviewers
mailing list