himanshu Dhingra
asked 9 years ago

Hello sir,
I am using wallpress and loving it.
I have made many changes in functions.php, search.php, footer, header.php and to some more, even added more things to css.
But the problem is that I have not created child theme and if wordpress automatically updates the wallpress theme(whenever available) then all the changes will be gone.
So if i create child theme, how to add the external changes made to all those php files to the child theme?

nobita
replied 9 years ago

Well, for your question , you can find something useful here: http://codex.wordpress.org/Child_Themes
Create a child theme, write header.php, footer.php ,functions. php and it'll overwrite, good luck and enjoy it πŸ™‚

1 Answers
DominicStaff
answered 9 years ago

Please refer the answer of @nobita provided. If you still face there issue, please let us known.
Regards,

himanshu Dhingra
replied 9 years ago

Thank you @nobita for the answer.I went through the article and found that if we want to add anything to functions.php, create a new functions.php in child theme and add the new things.But I have changed some of the codes in parent functions.php (ie, not added, but replaced the codes as per my requirements). How to proceed in this case?PS: I remember what all changes I had made.

nobita
replied 9 years ago

@himanshu Dhingra : well then, you can look for the information in here .http://codex.wordpress.org/Child_Themes#Using_functions.php.in your case , i think you should bring the function that you change to child theme , and use this :
" if ( ! function_exists( 'theme_special_nav' ) ) {
function theme_special_nav() { // Do something. }
} "

Because , functions in child theme are loaded 1st then if you have same functions with same name in parent theme, it'll not active πŸ™‚ , good luck πŸ˜€

himanshu Dhingra
replied 9 years ago

Thanks for reply,But i did not understood. Sorry :(Also i have changed search.php a bit, does i have to do the same for it too?

nobita
replied 9 years ago

Hi , the point here is that you can write all the functions you change in functions.php. And write them in side this wrap like this to make sure it’ll not ber override by main theme.if ( ! function_exists( ‘your function’s name’ ) ) { function () { // Do something. }}

Powered by DW Question & Answer Pro