WordPress.org

Ready to get started?Download WordPress

Forums

Convert modified parent theme into child theme (31 posts)

  1. ssguy69
    Member
    Posted 2 years ago #

    Hellllppppp!!!!!!

    I'm lost.

    How do I go about making a heavily modified parent theme into a child theme?

    I've been working with WP 3.0, twentyten theme. Did a bunch of mods to different files (I'm not a techie in the least but have figured out a few things and tweaked here and there). Recently read about the suggestion to work with a child theme in order to not lose mods.

    So I backed up/saved all the files from WP 3.0 twentyten theme and upgraded to WP 3.3 which comes with the TwentyEleven theme and would like to use the previously modified parent theme as a child theme to override the updated version. I've read about putting the info in the header for the child theme to reference the parent theme however I'm lost. I've made changes to the CSS stylesheet, and a quite a few other files How do I get everything that was working together in the previous parent theme (which I want to convert into a child theme) to take effect with the upgrade?

    Let me pre-empt WP veterans first-I'm rather a dunce with coding and terminology so I'd appreciate any and all help to be explained in the most basic of terms. Step by step direction are most appreciated.

    Right now my website is down because of the aforementioned and I'd like to get it up and running with the quickness.

  2. ssguy69
    Member
    Posted 2 years ago #

    After doing some research the following seems like the steps to follow:

    1) Create the new CSS style sheet and modify the header to refer back to the Parent theme.

    2) Any modified files in the Child theme should override those of the Parent theme.

    Is it that simple?

  3. 1) Create the new CSS style sheet and modify the header to refer back to the Parent theme.

    Pretty much. As long as you include the import in the style.css file of the parent CSS and put your styling after that (in the same file) your CSS will override the parent. The import is needed to get the styling from the parent as a starting point.

    It's very cool like that.

    2) Any modified files in the Child theme should override those of the Parent theme.

    Yes. Twenty Ten is also cool like that too. :)

  4. ssguy69
    Member
    Posted 2 years ago #

    Let me see how this works out.

    I think the import is to be included in the style.css of the child theme.

    Otherwise thank you for the response.

  5. ssguy69
    Member
    Posted 2 years ago #

    Okay still a bit lost.

    Do I nest the child theme with its modified files (function.php, images, custom files) and folders within the themes folder of the Parent theme?

    Looking at the file directory I'm not sure what is supposed to go where. With upgrading comes duplicate folders - those of the Parent theme and the already existing Child theme.

  6. esmi
    Forum Moderator
    Posted 2 years ago #

    Do I nest the child theme with its modified files (function.php, images, custom files) and folders within the themes folder of the Parent theme?

    No. It should go into wp-content/themes - just like the parent theme.

  7. ssguy69
    Member
    Posted 2 years ago #

    Thanks for responding.

    I'm back tracking here in that Im trying to convert a Parent theme that has already been modified into a Child theme.

    What about other folders and files(function.php, custom image files, etc,) that have either been modified or created? Where do I place these items in relation to the default duplicate folders of the new Parent theme?

  8. esmi
    Forum Moderator
    Posted 2 years ago #

    In the child theme.

  9. ssguy69
    Member
    Posted 2 years ago #

    In the actual 'Theme' folder? If I recall correctly I tried putting the 'WP-Content' in the that folder and I received a notification on the Admin panel that said 'WP-Content' was a broken theme without a stylesheet?

  10. esmi
    Forum Moderator
    Posted 2 years ago #

    In the folder of the child theme.

  11. ssguy69
    Member
    Posted 2 years ago #

    esmi,

    Stay tuned-your feedback and assistance is priceless. Thank you.

  12. ssguy69
    Member
    Posted 2 years ago #

    Does the actual 'WP-Content' folder of the Child theme go inside the Child's theme folder? I don't think that is correct. Also because of the upgrade there is another 'WP-Content' folder from the parent theme.

    Please recall that I'm working with what was a modified parent theme that I'm now trying to change into a child theme. Thus I have 2 WP-Content folders present-one from the upgrade and the previously existing prior to the upgrade. The previous one has custom image files and such in it. Where do I place it in relation to the new parent theme's WP-Content folder? Do I discard the parent theme's WP-Content folder?

  13. esmi
    Forum Moderator
    Posted 2 years ago #

    Themes do not have a "wp-content" folder of their own. The only wp-content folder on a WordPress site sits in the root of the install. I have no idea what these folders are doing in your themes. What theme is this and where did you get it from?

  14. ssguy69
    Member
    Posted 2 years ago #

    Twentyten theme.

    I think with the recent upgrade came a new WP-Content folder.

    My previous WP-Content folder with custom files is present. So do I move all its contents into the new WP-Content folder or discard the new WP-Content folder?

  15. esmi
    Forum Moderator
    Posted 2 years ago #

    The Twenty Ten theme does not have its own wp-content folder.

  16. ssguy69
    Member
    Posted 2 years ago #

    I have one. didn't create it myself.

    Any idea where it came from?

  17. ssguy69
    Member
    Posted 2 years ago #

    I'm thinking it should be moved out of the Themes folder.

  18. ssguy69
    Member
    Posted 2 years ago #

    Was able to move things around a bit and this is the message received after going into Admin panel and attempting to activate the child theme:

    Fatal error: Cannot redeclare twentyten_page_menu_args() (previously declared in /home/content/93/7359893/html/wp-content/themes/twentyten Child/functions.php:221) in /home/content/93/7359893/html/wp-content/themes/twentyten/functions.php on line 224

    So I'm thinking that because the child theme's function php file gets loaded before the parent's function php file, there's something duplicate going on. After reading the Codex it seems so type of correction is need.

    But to which file? Parent or Child?

  19. esmi
    Forum Moderator
    Posted 2 years ago #

    1. The child theme's must have a unique name
    2. You cannot just turn a copy of a parent into a child. Review child themes.

  20. esmi
    Forum Moderator
    Posted 2 years ago #

    You can download a basic Twenty Ten child theme from here.

  21. ssguy69
    Member
    Posted 2 years ago #

    1) Child theme does have a unique name: Twenty ten Child
    2) I understand the concept behind child themes

    I need assistance in resolving the following message that appears when I attempt to activate the child theme:
    Fatal error: Cannot redeclare twentyten_page_menu_args() (previously declared in /home/content/93/7359893/html/wp-content/themes/twentyten Child/functions.php:221) in /home/content/93/7359893/html/wp-content/themes/twentyten/functions.php on line 224

    Helllllllppp!!!!

  22. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    I need assistance in resolving the following message that appears when I attempt to activate the child theme:

    That means you're declaring - i.e. defining two functions with the same name.

    I'm assuming the likely cause is that you have copied/pasted all (or part) of Twenty Ten's functions.php file into your Twenty Ten Child's functions.php?

    At the very least, you have function twentyten_page_menu_args() {} in both files, which is the cause of this specific error.

  23. ssguy69
    Member
    Posted 2 years ago #

    Thanks Chip,

    I do have it in both files.

    How do I resolve it? Do I remove one of them from the themes and if so which theme?

  24. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    Remove it from the Child Theme.

    Don't put anything in the Child Theme that you don't intend to modify from its original state in the Parent Theme. Most likely, your Child Theme's functions.php file should be empty (and if so, it doesn't even need to exist at all).

    As for overriding Theme functions: you can only redeclare pluggable functions from the Parent Theme: that is, functions in the Parent Theme that are wrapped in a if ( ! function_exists() {} ) conditional. Or, if they are provided, you can use custom filters.

    If none of this makes any sense, you probably shouldn't be messing with functions.php to begin with.

  25. ssguy69
    Member
    Posted 2 years ago #

    Still plugging away.

    Would appreciate if someone could provide instructions on the file directory hierarchy.

    I have the 'plugins' folder inside my child theme folder but something tells me it doesn't belong there. Problem as well is that with the update came a parent theme plugin folder.

    Anyone have a few minutes to helping me sort out the mess I've created?

  26. Kabi
    Member
    Posted 2 years ago #

    Oh boy!
    That's how your directory should look like:

    wp-content includes the following folders:

    • languages
    • plugins
    • themes
    • upgrade
    • uploads
    • index.php

    your themes folder contains only the themes and child-themes.

    Also if you create a child-theme and a style.css for it, you have to include the refering theme's style.css file in the new style sheet:

    @import url("../twentyten/style.css");

    Hope it helps.

    Kabi

  27. ssguy69
    Member
    Posted 2 years ago #

    Thanks Kabi.

    Still trying to figure out where to place the child theme's plugin folder in relation to the parent theme's plugin folder.

  28. Kabi
    Member
    Posted 2 years ago #

    There's no separate plugin for each theme. Plugins are installed into the "wp-content/plugins" directory. It's a global settings, if that's the right use of word. Please guys correct me if I'm wrong. :)

  29. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    @ssguy69:

    Since you posted a separate topic for the Child Theme/Plugin issue, let's try to keep discussion of it there, so that others can more easily find the question and answers.

  30. ssguy69
    Member
    Posted 2 years ago #

    So I have figured that I'll move the plugin folder that was previously present prior to the upgrade to wp-content/plugins and delete the new plugin folder that came with the recent upgrade.

    Am I on the right track here?

Topic Closed

This topic has been closed to new replies.

About this Topic