[theme-reviewers] Child theme settings overwriting parent theme settings

Thomas Usborne hello at edge22.com
Wed Jun 18 23:40:56 UTC 2014


Spent the last hour looking into get_theme_mod as opposed to get_option – wish I looked into it more before releasing my theme using get_option for everything.

 

Tom

 

From: theme-reviewers [mailto:theme-reviewers-bounces at lists.wordpress.org] On Behalf Of Otto
Sent: Wednesday, June 18, 2014 4:34 PM
To: Discussion list for WordPress theme reviewers.
Subject: Re: [theme-reviewers] Child theme settings overwriting parent theme settings

 

I agree with this. If you're using the get_theme_mod and set_theme_mod functions for all your theme options, then there is no conflict. Each theme will have its own set of settings entirely.

 

Also, theme-mods are by far the easiest way to use the Theme Customizer screen. Realistically, I think all themes should try to use that instead of any form of get_option and such. 

 




-Otto

 

On Wed, Jun 18, 2014 at 5:29 PM, Justin Tadlock <justin at justintadlock.com> wrote:

If you point me to some actual code, I might be able to help you.  It's pretty easy to do per-theme settings (including child themes) if you use the Theme Mods API.  Theme mods are saved based on the stylesheet, so a child theme has different settings than its parent.  Plus, there are existing hooks available if you want overwrite the default.

 

On Wed, Jun 18, 2014 at 4:12 PM, Thomas Usborne <hello at edge22.com> wrote:

Hey guys,

 

So I have a child theme that uses filters to change the parent theme's options which change the appearance of the theme.

 

However, when using filters to change the default parent theme's settings, those defaults don't take place if the user has already saved their own custom options using the parent theme.

 

This means when the user tries to install the child theme, it won't look as it should, because the defaults have already been changed by the user, and ignore the child theme's filters.

 

Upon activation I had it so the parent theme's settings reset, making way for the child theme's settings.

 

I thought this was the best way to remedy the situation, but I've been informed by Chip that child themes can't delete or overwrite the parent theme's settings.

 

Do I have any other options here? 

 

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/20140618/a340ead0/attachment-0001.html>


More information about the theme-reviewers mailing list