[Support request] Including Parent theme file in Child theme

Home Forums Support [Support request] Including Parent theme file in Child theme

Home Forums Support Including Parent theme file in Child theme

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1508693
    Jill

    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

    #1508704
    Leo
    Staff
    Customer Support

    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 🙂

    #1508713
    Jill

    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

    #1508732
    Leo
    Staff
    Customer Support

    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?

    #1508744
    Jill

    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?

    #1508765
    Leo
    Staff
    Customer Support

    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/

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.