Archived topic
Including Parent theme file in Child theme
5 replies · Started by Jill on October 28, 2020
Dear Support
To create my site, i had to modify inc>structure>header.php file of parent theme.
so in child theme how i can include that file?
i tried to add that file in child theme (maintaining same structure), but that didnt work
would you mind to kind enough to share me the procedure please?
Kind Regards
Hi there,
I tried to add that file in child theme (maintaining same structure), but that didnt work
That's the correct method. You just need to copy the header.php file and paste it into the child theme folder:
https://github.com/tomusborne/generatepress/blob/master/header.php
What are you trying to modify in the header.php file?
A lot of modification can be done with hooks :)
Hello Leo
thanks for your comments
actually it is not main header.php, i am referring inc>structure>header.php of parent theme.
i needed to modify that file, so what i did, i copied that file in child theme. but that didnt work
would you mind to check the screenshot please?
https://www.journalbuddies.com/wp-content/uploads/2020/10/parent-theme-file-in-child-theme.jpg
By default, WordPress only allows child theme overwrites on the first level of files - so the files directly under the theme folder.
What is that code you are trying to add?
Did the source provide any information on how to add it?
Thanks Leo
that is some buttons i wanted to add. and i am coding it using html and css.
i need to add those code in inc>structure>header.php ( as i shown in red block)
so can i add or you can help from theme support to include that file as a part of child theme?
or it is not possible?
It's not possible to modify that header.php file like that and I don't think it's necessary at all.
Where would you like the buttons to appear?
Have you considered using hooks or widget area?
https://docs.generatepress.com/article/hooks-visual-guide/
https://docs.generatepress.com/article/hooks-element-overview/
https://docs.generatepress.com/article/header-widget/