How To Edit ,php Files Using A Child Theme
-
Hi, everyone. I just started understanding and using a child theme. I understand that using a child theme will secure my theme from experiencing any alterations from updates.
I am trying to understand how to edit .php files using a child theme. I am trying to remove the line of code in the Header.php which calls the search bar. Please let me know if this is the right way to edit a .php file.
I created a new Header.php file in my child theme, and I copied the line of code from the parent theme’s Header.php, and pasted it in my child theme’s Header.php. After saving, my page looked as if all the code had been removed from it, there was virtually nothing on it.
I then took all the code from the parent’s Header.php, and pasted it into the child’s Header.php, and commented out the search bar code, and after saving the search bar was gone and everything on the page looked the way it should be.
But what I don’t understand is, what happens now if an update does in fact happen? Will the update have no effect on the various .php files I choose to customize? Also, what is the point of using a child theme specifically for .php files if the whole page of the parent’s .php file needs to be copied over to function properly, if any update won’t take effect on the child?
I hope I explained this well enough 🙂
Thanks!
The topic ‘How To Edit ,php Files Using A Child Theme’ is closed to new replies.