I'm developing a child theme, but also want to make it possible for that child theme to have a custom functions.php file that won't be overwritten during theme updates .. is this possible in any manner?
1 Answer
You can add a custom functions.php to your child theme. As long as it's in the child theme folder, it will not be overwritten when you update the parent theme.
See http://codex.wordpress.org/Child_Themes. Read the section "Using functions.php"
-
But is there a workaround for preventing overwriting a file in the child theme when the child theme is automatically updated? Basically treating the child theme like a parent theme as well. Commented Jul 21, 2014 at 15:36
-
I'm not sure. In my mind, the child theme is the "static" element where you actively are preserving and protecting the settings/options from being changed when the parent theme updates. After the design is complete, what would precipitate a child theme upgrade? If you want to preserve functionality, independent of what happens with the theme, why not create a plugin that is not theme dependent? Commented Jul 22, 2014 at 21:02
-
In the instance of designing/selling a child theme, having the ability to update the child theme while also providing a place for the customer to make 'static' changes that wouldn't be overwritten should an update need to be pushed out for the child theme. I guess it would be something like a grand-child theme, but what I've found in searches says it's not currently an option? I guess a separate plugin to provide customizing outside of the child theme would have to be the best option for now. Commented Jul 23, 2014 at 23:33
-
This is growing outside of my knowledge, but I believe you should be able to create a library folder for your child theme that would contain the changes that you would normally put in function.php, which would leave the child theme's function.php available. When you provide the update, overwrite all of the files in your child theme with the exception of the functions.php. Commented Jul 24, 2014 at 23:17