WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Mistake not creating a child theme (36 posts)

  1. wpbnewbie
    Member
    Posted 1 year ago #

    So i have a site still on WP 3.2. I have been afraid of upgrading it because i foolishly did not create a child theme when i put it together last year. I am afraid i will break it if i upgrade. I know i changed the content of several files when i put it together but can no longer remember which ones i messed with. How do i now go about creating a child theme without screwing something up? Do i just grab all files in my current theme and copy them into my new child theme and them download a fresh copy of WP3.2 to use as my untouched theme? After that, i should then be able to move up to WP3.5 right? Please advise.

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    What theme are you using?

  3. I think that your mistaking the theme and WordPress installation. If you simply upgrade to WP 3.5 that will not touch your theme files. Your theme files are only altered once you upgrade the theme.

    If I were you, I would upgrade to the latest version of WP, but make a back up of your theme just in case. If there are any issues, then you can re-upload the theme, but there shouldn't be any.

    It's good to have a theme backup anyway.

  4. wpbnewbie
    Member
    Posted 1 year ago #

    I am using the standard twenty eleven theme. Christine are you saying that upgrading to WP3.5 will not also bring along Twenty eleven 1.5?

  5. wpbnewbie
    Member
    Posted 1 year ago #

    I am using the standard twenty eleven theme. Christine are you saying that upgrading to WP3.5 will not also bring along Twenty eleven 1.5?

  6. If you upgrade to WP 3.5, Twenty Twelve does come bundled with it, but it doesn't replace your current theme Twenty Eleven will still be there.

  7. wpbnewbie
    Member
    Posted 1 year ago #

    But i have twenty eleven 1.3. WP3.5 will probably bring twenty eleven 1.5 with it. This will mess my site up as it will have default untouched files as opposed to my altered 1.3 files. Is that not right?

  8. Latka
    Member
    Posted 1 year ago #

    backup your site and try it. If it all goes horribly wrong just restore your backup. If you have cpanel or some other control panel your web host provides just back everything up and restore it if you need to

  9. wpbnewbie
    Member
    Posted 1 year ago #

    I know i can back it up but i would still like to know if my thinking is correct as far as WP3.5 bring TE1.5 with it.

  10. waheed
    Member
    Posted 1 year ago #

    hi
    i need help on side baar i have more then 140 catagories on side bar
    i want to show just 10 catogries and then "view more" link then user click on view more catogires get opens
    thanks in advance

  11. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    waheed - please start your own thread -- it's rude to interrupt another person's thread and your question is completely unrelated.

    You can do that here:

    http://wordpress.org/support/forum/how-to-and-troubleshooting#postform

  12. leejosepho
    Member
    Posted 1 year ago #

    Having already done a little of this on a smaller scale, I would download a clean copy of your theme and use something like Notepad++ to compare your pages with fresh ones in order to define and assemble a proper Child Theme. Then after de-activating all plugins and getting your new Child Theme running (to check it to be sure all is well there), I would next revert back to the Parent Theme to do the WordPress update...then re-activate your new Child Theme and plugins.

  13. wpbnewbie
    Member
    Posted 1 year ago #

    So i went ahead and created a child theme. When i activated it, i immediately got a fatal error message. After further googling, i discovered that i cannot have the same function.php file in the parent and child. I removed the one from the child just to recover my website. Now i am confused about this function.php file. I for sure need one in my child theme but from what i have read, i have to manually create one from scratch? Can anyone give simplified instructions on how to proceed from here? Thanks.

  14. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Review:

    http://codex.wordpress.org/Child_Themes

    You don't necessarily need one in your child theme. The only files in a child theme are those that are different from the parent theme.

  15. wpbnewbie
    Member
    Posted 1 year ago #

    Unfortunately in my case, i require a function.php in the child theme as it appears to be one of the ones i modified the most when i initially set up the site. I read that link before posting and it was still a little confusing to a newbie like me.

  16. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Then you will likely need to compare the contents of an unmodified version of the file to yours. Some text editors can help with that.

    Make sure that you are making frequent back-ups and copies of files as you are doing this kind of thing :).

  17. wpbnewbie
    Member
    Posted 1 year ago #

    Did that already yogi. I see the differences. The problem i am having is how to now implement it. Do i move the function.php from parent to child and put an unaltered copy in the parent?

  18. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Put the changes you made in the child theme and an unaltered copy in the parent.

  19. wpbnewbie
    Member
    Posted 1 year ago #

    Thanks. Will try this evening and report back.

  20. wpbnewbie
    Member
    Posted 1 year ago #

    Wait a sec. Did you mean just the changes alone or the entire changed function.php?

  21. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Just the functions that you added to the parent should be moved to the child theme functions file.

    http://codex.wordpress.org/Child_Themes#Using_functions.php

  22. wpbnewbie
    Member
    Posted 1 year ago #

    okay. Will try later. Thanks.

  23. wpbnewbie
    Member
    Posted 1 year ago #

    I just discovered that contrary to what i said earlier, only 2 lines of code were changed in my original function.php file. The lines are below:

    define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyeleven_header_image_width', 1000 ) );
    define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyeleven_header_image_height', 200 ) );

    For the new function.php that will go in the child theme, i am still lost. I know those 2 lines have to go in it but what else do i need to put in there? Please use the simplest terms as its obvious i am not strong in this field. Thanks.

  24. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Just an opening php tag at the top and a closing one at the end of your code - but do be sure that you have no empty spaces at the top of the file -- as those can cause problems. Also create it in a plain text editor (not something like Word).

    <?php
    
    ......your code here
    ?>
  25. wpbnewbie
    Member
    Posted 1 year ago #

    Thanks Yogi. I did not get any fatal errors so i guess that is a good start. However, it did not work. My header height, pictures and colors defaulted to the standard twentyeleven ones. FYI, i have header.php, footer.php, style.css and function.php in my child theme folder. Custom text i put in footer.php showed up when i switched to the child theme. The style.css file is essentially the same one from the parent except for the custom text at the top that identify this as a child theme.

  26. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Your child theme css file should only have the changes to the CSS that you've made - not a copy of the entire file. If you've made tons of changes, it can be a copy - but that really makes it harder to manage your CSS and it creates duplicate code which slows down your site.

    What is in the header of your child theme stylesheet above the styles in it?

    Also, theme settings and options won't carry from a parent to a child theme so you'll need to redo those. It's like switching to any other new theme.

  27. wpbnewbie
    Member
    Posted 1 year ago #

    Of the 2700 lines of code listed in styles.css (Yes i know some lines are blank), my changes are only about 30 lines. For now while i am still trying to figure it out, i will leave it as is (i.e. an exact copy of parent css) since you say it is not ideal but should still work.
    I am confused as to the last two things you asked about: whats in the header and theme settings not carrying through.

  28. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    except for the custom text at the top that identify this as a child theme.

    Can you copy that custom text from the child theme style.css file here? Including the @import ... line.

    Anything you set up in the parent theme using the theme options might not carry over to the child theme.

    Can you also post a link to your site - it will help me see if the child theme is working right.

  29. wpbnewbie
    Member
    Posted 1 year ago #

    Unfortunately i cant link to it as it is not publicly accessible. The text up top is just like this:

    /*
    Theme Name: Twenty Eleven child theme
    Description: test theme
    Author: Tester
    Author URI: http://mysite.com
    Template: twentyeleven
    */
    
    @import url("../twentyeleven/style.css");
  30. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    So that looks fine. But just to be sure, is the child theme active? i.e. you have to switch to it like any other theme.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags