WordPress.org

Support

Support » Themes and Templates » [Resolved] How to make a Child theme from a modified parent theme

[Resolved] How to make a Child theme from a modified parent theme

  • I’m trying to make a child theme from a modified parent theme. And it seems like copy and pasting all the files from the modified parent theme to the child theme was a bad idea. Any suggestion?

    Thanks in advance.

Viewing 15 replies - 1 through 15 (of 31 total)
  • esmi

    @esmi

    Forum Moderator

    Why was the parent theme modified?
    Why bother creating a child theme if you’re modifying parent themes (which I wouldn’t actually recommend)?
    Why would you need to copy all of the files into the child?

    Look I’m new at this. My friend wanted me to create a website for her using wordpress so I did. I never even heard about a child theme until a couple of days ago but it was too late I already made modifications to the parent theme. I made a rookie mistake. What files do I need to make to create my child theme. The parent theme seems to be effected by this.

    WPyogi

    @wpyogi

    Forum Moderator

    What files did you modify? (Theme options are not file changes.)

    I modified the CSS and two lines in the function.php file.

    And the header.php file

    WPyogi

    @wpyogi

    Forum Moderator

    Do you now have a working child theme set up?

    The best thing to do is to move the changed header.php file to the child theme and replace it in the parent theme with an unchanged version.

    For the style.css file, ideally, you’d move only your changes to the child theme style.css file – you can use a text editor to compare the changed file to the unchanged version. As a last resort, you can move all the parent styles to the child theme style.css file, but that makes things harder to work with your CSS and creates duplicate code.

    For the functions, see the directions about child themes – and how to put functions in the child theme. The replace the functions.php file in the parent with an unchanged version via FTP.

    Yeah. The child theme seems to be working. Its have some wired issues formatting issues because I copied and pasted everything from the original minimatica to the child theme. I guess I’ll make a back up copy of the original modified theme to my computer and play around with it early in the morning so no one will notice the changes since my friend already launched the site to the public already.

    Also, I know this is off topic but do you know how I can make a sharing thumbnail of the website?

    Look I’m new at this…

    Same here, and now I understand how at least some things work. So, here is what I would do in your situation:

    1) Copy your entire theme folder as it is right now into a temporary location somewhere;
    2) Download a pure, unadulterated Parent Theme to a convenient place;
    3) De-activate all plugins;
    4) Upload/Overwrite that downloaded Parent Theme into your presently-active-but-modified Parent theme.

    At that point, I believe you should have a clean Parent Theme running. So next, and to make a proper Child Theme from what you had before:

    1) One at a time, set each-and-every file you had previously altered next to a copy of its original from the pure, unadulterated Parent Theme you had downloaded to a convenient place;
    2) Remove from your own copies any redundant code the Parent Theme would normally be running anyway;
    3) Repeat #1 and #2 until the files in your coming-to-be Child Theme only contain altered code;
    4) Change the beginning of your previous style.css into that of a style.css for a proper Child Theme;
    5) Upload your new Child Theme to its proper location and activate it;
    6) Re-activate your plugins.

    Without ever having to change an entire theme that way, that kind of handling has worked for me.

    WPyogi

    @wpyogi

    Forum Moderator

    2) Remove from your own copies any redundant code the Parent Theme would normally be running anyway;

    The above does not apply to the header.php file. The header.php has to be a complete version (modified) of the file – not only the changed portions.

    With functions.php, make sure you follow the instructions in the Codex for adding the new functions to a file in the child theme.

    The above does not apply to the header.php file. The header.php has to be a complete version (modified) of the file – not only the changed portions.

    I thank you for that correction, and I just checked mine to be sure all is well there. Also, and after posting the above, I later remembered I had actually done this (in the first part):

    1) Copy your entire theme folder as it is right now into a temporary location somewhere;
    2) De-activate all plugins;
    3) Download and active a different theme altogether (I used Twenty Eleven in place of my Twenty Twelve);
    4) Delete the compromised theme completely;
    5) Re-download and activate your regular theme…

    …then proceed with whatever must be done so you can activate a new Child Theme.

    Okay I’m attempting to make the child theme now.
    This is my code

    /*
    Theme Name:     Minimatica Child
    Description:    Child theme for the Minimatica theme
    Author:			Z.G. Designs
    Template:       minimatica
    Version:        0.1.0
    
    */

    But it doesn’t seem like it taken. I deactivate and delete the modified parent theme and re-installed it. Currently the 2011 theme is actived now.
    I seem to be getting some error

    Template is missing.

    But I reinstalled the original theme. I’m confused.

    WPyogi

    @wpyogi

    Forum Moderator

    Do you have the @import line in the child theme style.css file.
    This is what should be in the file:

    /*
    Theme Name:     Minimatica Child
    Description:    Child theme for the Minimatica theme
    Author:			Z.G. Designs
    Template:       minimatica
    Version:        0.1.0
    */
    
    @import url("../minimatica/style.css");

    WPyogi

    @wpyogi

    Forum Moderator

    Also make sure your file structure is correct.

Viewing 15 replies - 1 through 15 (of 31 total)
  • The topic ‘[Resolved] How to make a Child theme from a modified parent theme’ is closed to new replies.
Skip to toolbar