I would like to know what is the best way to modify a file in Wordpress, such as header.php or single.php so when you update the theme, the changes remain there. I am not sure if this can be done with a child theme or if a plugin is needed.
3 Answers
If you want to make changes to the template files (e.g. header.php, single.php, etc) you should create a child theme.
-
Thanks @Natalia - I follow this other tutorial and it was easier: elegantthemes.com/blog/resources/wordpress-child-theme-tutorial– AlexJul 1, 2015 at 23:03
-
Whatever you find easier! I always consult the Codex. Glad I've helped! :)– NataliaJul 3, 2015 at 2:51
when you use a theme that will be updated, make a child theme
you just have to copy the header.php from the parent to the child and the child version will be used by WordPress
If you modify a theme directly and it is updated, then your modifications may be lost. By using a child theme you will ensure that your modifications are preserved.
How to create a child theme -> Wordpress Codex quick guide
If you want to create functionality that will be reused in your another projects, create plugins.
Thanks
Vee