Theme Options for both parent and child themes
Closed this issue · 3 comments
Possibly a question buried within the closed issues, but nonetheless Is it possible to have theme options active for both the parent and child theme?
Not quite sure what you mean. Use the same set of saved options whether the user has the parent or child active?
From the parent theme, I have options set for all themes. But I would also like to set distinct options for each of the child themes, without overriding the options in the parent theme. Is this possible?
Sure. You'll have to save all options (parent/child) under the same option name. So, make sure you explicitly set the option name.
You can load the default parent theme options + child theme option in a number of ways.
-
Create a function that returns the parent options array that's included from functions.php. Call that in options.php of the parent theme, and in options.php of the child theme. Append any additional options as well in the child theme.
-
Filter the options in the child theme to append additional options.
-
Simply duplicate options.php from the parent theme in the child theme and add your additional options.
If you have the same option in several child themes, but want those to be unique per child theme, prefix the option name in the options array.