how do i create a child theme and keep the current settings?

hey. the wpmudev way of creating a child theme was a bit confusing to me.

i have done a lot of customization on a theme within it's own parameters. I know by updating the theme it will wipe that out; and I am, after the fact, wanting to create a child theme from it (and the multiple other sites which i've used the theme on).

How can I create a child theme that copies over the current parameters for the theme? (so that when the theme is updated, my alterations stay)

  • Michelle Shull

    Hey, Griff!

    Do you have a list of the files you edited in your parent theme? Just copy them over to your child theme, and WordPress will read the child theme files first. Your changes will get overwritten in the parent theme when it updates, but as long as you copied each file to the child theme first, you'll be good.

    With CSS and functions.php, it's a little different. You'll only want to put CSS changes in the child theme's style.css, don't copy over any elements you didn't change.

    Functions.php is a different animal entirely - check out this bit from the codex for all the details here: https://codex.wordpress.org/Child_Themes#Using_functions.php

    With template files, WordPress will look for them in your child theme first, and use them instead. With CSS and functions, WordPress will use your child theme files in addition to the parent theme files, and will load the child theme files first.

    So, step by step:
    1. Copy any template files you've edited to your child theme. If your parent theme uses subfolders, make sure you follow that same folder structure in your child theme. So if you edit thingamabob.php which is in wp-content/themes/parent-theme/inc, you'd need to copy it to wp-content/themes/child-theme/inc.
    2. Copy any changes you've made to your parent theme's styles.css to your child theme's styles.css.
    3. Move any functions you've added to the parent theme's functions.php to your child theme's functions.php.

    Now you can safely update the parent theme, and all your custom tweaks are safe. :slight_smile:

    Let me know if you need any more info here, Griff!

  • Bojan Radonic

    Hey there @Griffin, hope you're well today!

    As Michelle already said above you'll have to move all modifications done to your theme to your child theme in order for them to be safe when you update your parent theme.

    If something is part of the parent theme there is no reason for you to move that to your child theme, only the custom part such as CSS.

    If you're unsure how to do that could you please add more information on the theme that you're using and which modifications are made and we'll be happy to help :slight_smile:

    Cheers,
    Bojan

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.