• Resolved wpbnewbie

    (@wpbnewbie)


    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.

Viewing 15 replies - 16 through 30 (of 35 total)
  • Thread Starter wpbnewbie

    (@wpbnewbie)

    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?

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

    Thread Starter wpbnewbie

    (@wpbnewbie)

    Thanks. Will try this evening and report back.

    Thread Starter wpbnewbie

    (@wpbnewbie)

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

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

    https://codex.www.ads-software.com/Child_Themes#Using_functions.php

    Thread Starter wpbnewbie

    (@wpbnewbie)

    okay. Will try later. Thanks.

    Thread Starter wpbnewbie

    (@wpbnewbie)

    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.

    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
    ?>
    Thread Starter wpbnewbie

    (@wpbnewbie)

    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.

    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.

    Thread Starter wpbnewbie

    (@wpbnewbie)

    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.

    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.

    Thread Starter wpbnewbie

    (@wpbnewbie)

    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: https://mysite.com
    Template: twentyeleven
    */
    
    @import url("../twentyeleven/style.css");

    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.

    Thread Starter wpbnewbie

    (@wpbnewbie)

    Its currently not active since whenever i go to it the header color, height and pictures are the default twentyeleven and look out of place. I am still using the parent for now.

Viewing 15 replies - 16 through 30 (of 35 total)
  • The topic ‘Mistake not creating a child theme’ is closed to new replies.