WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Child Theme: How To Make Template Changes? (4 posts)

  1. Andrew Nevins
    Barrel Rider, Spam Zapper & Volunteer Moderator
    Posted 1 year ago #

    Hello,

    I remember being lectured not to copy & paste template files from the Parent, into the Child Theme. This causes incompatibility whence themes update?

    How would you make changes to a template file, within a Child Theme?

  2. dragonsjaw
    Member
    Posted 1 year ago #

    I usually don't copy the function.php file, I just create a new function.php file for the child theme with whatever changes I want in there.
    So if you need to make changes to say the header.php you can copy the header.php and make your changes in the child theme.

    As the child theme files are pulled first.
    I will use the page.php to create a new page template.

    I don't understand your being lectured 'not' to copy template files from parent to child. ? anyone??

  3. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    If you want to modify a template, the only way is to copy from parent to child!

    I'm not sure who would have lectured, it's the only way to do it since templates are not usually full of hooks, etc to latch on to

    Of course that rule doesn't apply to functions.php, but we are all aware of that here!

    I almost always have to copy header.php to my child to modify layout. When a new version comes out, I just run a diff to see what I need to update in my child version. Or copy the new header.php and redo my changes

  4. dragonsjaw
    Member
    Posted 1 year ago #

    Thanks Rev, I was trying to understand why Andrew was lectured!
    Good to know I have been correctly modifying templates.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.