WordPress.org

Ready to get started?Download WordPress

Forums

Child Themes and modifications to php files other than functions.php (7 posts)

  1. paulh16
    Member
    Posted 1 year ago #

    Hello,

    I have a basic question on child themes. I know the benefit of using them is that your changes will remain if the theme it is based on is updated. I have followed the Codex and made created a functions.php file inside my child theme directory. However, what if I make changes to the original theme's non-functions.php files, such as header.php and footer.php. Do these changes get wiped out if the theme is later updated? I am just modifying the copyright wording in the footer.

    Thanks!

  2. KrashKartMedia
    Member
    Posted 1 year ago #

    yes. if you update the original (parent theme) to the latest theme version, (1.2 to 1.4), what you are doing is installing the theme, activating it and then using anything in that folder. So what you want to do is make any changes you have in the same .php page, but in the child theme.

    so make a new header.php page, copy all the stuff from the original page to the new page, add it to the child theme folder and make your changes there. then when the update comes in or tells you to update, before you install it, or update, download a copy to your computer and see what changes have been made.

    most theme authors have a changelog, or should be able to answer you if you ask "what changes did you make".

  3. paulh16
    Member
    Posted 1 year ago #

    Thank you very much! Great explanation.

  4. Chip Bennett
    Theme Review Admin
    Posted 1 year ago #

    Even easier: if you need to make changes to header.php, then copy wp-content\themes\parent-theme\header.php into wp-content\themes\child-theme\, and then make changes in the latter location.

    Most Theme updates do not involve changes to the template files themselves, so the vast majority of the time, your Child Theme template files will be future-proof. However, if you need to know what has changed from one version to the next, I would recommend using the diff tool in Theme-Trac to see such changes easily.

    What parent Theme are you using? I'll show you how to use the diff tool for that Theme.

  5. Chip Bennett
    Theme Review Admin
    Posted 1 year ago #

    Here's the diff for Twenty Eleven 1.3 compared to the previous version, 1.2:
    http://themes.trac.wordpress.org/changeset?old_path=/twentyeleven/1.2&new_path=/twentyeleven/1.3

    That URL structure has a standard convention, that can be applied to any Theme, and any version. You just need to know:

    1. Theme slug
    2. Old version number
    3. New version number:

    http://themes.trac.wordpress.org/changeset?old_path=/{themeslug}/{oldversion}&new_path=/{themeslug}/{newversion}
  6. paulh16
    Member
    Posted 1 year ago #

    Hi Chip,

    Thank you very much for the suggestion to make copies of the template files! This really isn't explained in the Codex nor in Lynda's course on Child Themes. In the Lynda course they were making changes in the original template files and I knew there was something wrong with that if those files were later updated. I will definitely check out Theme-Trac.

    I usually make children out of the Twentyeleven or Responsive themes.

    Thanks again for your great explanation!

    Paul

  7. Chip Bennett
    Theme Review Admin
    Posted 1 year ago #

    In the Lynda course they were making changes in the original template files...

    Ay de mi! Making any changes to the original Theme's template files pretty much completely defeats the purpose of using a Child Theme.

Topic Closed

This topic has been closed to new replies.

About this Topic