• rafaelzenato

    (@rafaelzenato)


    Hi, guys.

    I think I’m in big trouble… I always edited my site in the main css and html sheets.

    I know now that, if I update my version of WP all I’ve modified will be erased.

    I have backups, so I think I would at least have a little help to find all the editing.

    Can someone please help me and guide me to do the child theme’s css and html and how to put the edited codes I have into the new ones?

    Thank you so much in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Siobhan

    (@siobhyb)

    Hi @rafaelzenato,

    I know setting up a child theme after already making a lot of edits to your parent theme may seem like a daunting task but it’s definitely worth the effort and we’ll be happy to help with questions that come up along the way.

    We have a guide on setting up a child theme here:

    https://codex.ww.wp.xz.cn/Child_Themes

    I recommend installing WordPress to your computer’s localhost, activating Sela, and then replicating your main site in a child theme from there.

    Your style.css and functions.php files are the ones that may take some work to replicate. If you have a record of the other files you’ve edited, you can copy them directly to your child theme.

    Once you have replicated your site, you can then transfer it over to your main host.

    Let me know how you get on or if questions come up.

    Thread Starter rafaelzenato

    (@rafaelzenato)

    Hi @sionhyb.

    Thank you for your response and sorry for the delay reply.
    I looked into the links you sent and other tutorials on YT, but I’m not sure if I will make the right thing.

    About the style.css and functions.php files, can I change the header as shown on the instructions and then just copy all the rest (code)?

    And about the other .php files, can I just copy then and paste into the new “sela-child” folder?

    Another question is about after the child theme’s creation: I should go in appearence>themes> and then change from Sela to “Sela-child”? Is anything else I’ll have to manually change?

    I’m sorry about all the questions.. I’m really not an expert and I’m afraid to lose the changes I’ve made.

    Thank you for all your help. I really appreciate it.

    Have a good day =)

    Hi @rafaelzenato,

    About the style.css and functions.php files, can I change the header as shown on the instructions and then just copy all the rest (code)?

    Yes, you can copy the code directly from the instructions. You will need to edit parts of the code for the style.css file to make sure the information matches up to Sela, but the code for functions.php does not need to be edited.

    Here’s an example of what the edited header information in your child theme’s style.css file may look like:

    /*
     Theme Name:   Sela Child
     Description:  Sela Child Theme
     Author:       Your Name
     Template:     sela
     Text Domain:  sela-child
    */

    The most important part here is the the Template name. It needs to exactly match your parent theme’s name. This “tells” the child theme where to inherit its styles and code from.

    And about the other .php files, can I just copy then and paste into the new “sela-child” folder?

    That’s right! For example, you can copy header.php from the parent theme to your child theme’s directory and edit it directly there. The child theme’s header.php file will be loaded first and will be used in place of the paren’t file.

    Another question is about after the child theme’s creation: I should go in appearence>themes> and then change from Sela to “Sela-child”? Is anything else I’ll have to manually change?

    You will need to activate the child theme from under Appearance > Themes, yes. There aren’t any other manual changes for you to make.

    I’m sorry about all the questions.. I’m really not an expert and I’m afraid to lose the changes I’ve made.

    Please don’t be sorry! We’re happy to help with any questions you have on getting setup. 🙂

    I also very much recommend a talk from my colleague, Kathryn, where she does a very job of explaining the ins and outs of child themes, as well as the steps to get setup with one:

    Let me know if you have other questions.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I always edited my site in the main css and html sheets.

    Just so you know, you don’t always have to enqueue the parent theme stylesheets.

    If you have made significant modifications to the parent theme’s style.css file for example, you might find it’s easier to just copy the whole CSS from the parent theme style.css file and paste it into your Child Theme style.css file. Then you would not need to enqueue the parent theme’s style.css file.
    Though note that your Child Theme wouldn’t be strictly inheriting from the parent theme.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Child Theme editing’ is closed to new replies.