Link to home
Start Free TrialLog in
Avatar of Pete Long
Pete LongFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Wordpress - Themes and Child themes

Wordpress - Themes and Child themes

OK Ive got a Wordpress site that has a theme, and at some time in the past Ive created a child theme and made some changes, all good
BUT, before I knew what I was doing, I made some direct edits on files in the parent theme.

Now I've compared the live sites theme with the original factory default, and the files that have changed are....

footer.php
functions.php
header.php
style.css

So, my question is, If I coped those file to the Themename-Child directory, I should be able to update the theme without anything smashing correct?

The problem is compounded, as in the child theme I also have a functions.php and a header.php file?

From what I've read it's probably using the header.php from the child theme anyway?
But Ive also read that functions.php loads the child and the parent, so Im not sure what to do about that one?

Regards,

Pete
Avatar of David Favor
David Favor
Flag of United States of America image

Best to truly fix this by...

1) Run a diff parent + child theme files.

2) Move parent file changes into child theme.

3) They your parent theme updates will work.

Whether or not you can just copy the files from parent -> theme depends on both your parent + theme files.

Likely answer is no... unless you're willing to work through + fix many complex + oddball + difficult to debug problems.
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
From what I've read it's probably using the header.php from the child theme anyway?
But Ive also read that functions.php loads the child and the parent, so Im not sure what to do about that one?
Both functions.php files are loaded.
child theme functions fired
parent theme functions fired
child theme header fired
child theme footer fired

Open in new window

Avatar of Pete Long

ASKER

Thanks Guys

>>(Remember to keep a backup of your last known good setup (files + db) so you have something to go back to if there is a problem.)

Way ahead of you there, I've migrated and rebuilt it enough times to be slick at restoring it

Im just taking a closer look at the header and functions php to see the differences
Got the difference between the Original functions.php and the one in my Master theme.
Then copied that difference to the functions.php file in my child theme.

Site seems to be OK - I will need to flush the caches.

Ill keep an eye on it for a while
Mmm spoke to soon, The only actual thing thats been added to my functions.php is

function stop_removing_tags(){
    remove_filter('the_content', 'wpautop');
}


add_action('init', 'stop_removing_tags');

Open in new window


Which is a fix for Wordpress removing tags, relocating that into the child themes function.php takes the site down?
What is in your error log?
I reversed it an Im back up :)

Ive sat and compared all the changed files and documented the changes, so I know whats where and what Ive changed, with that in mind, I'm going to bite the bullet and update the master theme.

Thanks for both of your assistance today.

Pete
You are welcome.