Eugen-Andrei Coliban
Eugen-Andrei Coliban

Reputation: 1090

How to move all modifications made in a parent theme to a child theme?

I'm working upon a Wordpress project, and due to my inattention, I started to make all the modifications in my parent theme, which I installed in.

Now that I realised, that I should work with the child theme instead, I've put it, and the issues that I'm confronting with, is that all the logos and backgrounds which I've added, are now set to default (if I switch to parent theme, everything is good). Is there an easy method of moving all these changes from parent theme to child?

Also, in the parent theme, I've edited the 404.php file, will it be reverted back to normal, if there'll appear an update to the theme or not? If so, is it possible to move the modifications made in parent theme's 404.php to the child theme?

Upvotes: 1

Views: 1413

Answers (1)

gael
gael

Reputation: 1493

You shall first make a copy of the parent theme you have created lets call it modified-parent-theme.

Then import the original parent theme you chose (lets call it clean-parent-theme).

And Create an empty child theme as described here:

https://developer.wordpress.org/themes/advanced-topics/child-themes/#how-to-create-a-child-theme

Associate it to the parent theme you wanted to use in the main stylesheet: style.css

/*
 Theme Name:   Your Child Theme
 Template:     clean-parent-theme
*/

Then you can simply move the files you modified from your theme folder (modified-parent-theme) to the child theme directory.

Those files (like 404.php...) will override Parent theme's files automatically and you will keep the ability to update your parent theme without losing customisations.

Upvotes: 1

Related Questions