• willc93

    (@willc93)


    I found an article talking about a child theme and the importance of it but I still don’t really understand what it does. From my understanding, I would create a child theme of my parent theme and make adjustments to it there – in case the parent theme is updated. What I don’t really get is:
    if I make the child theme the permanent theme/activate it, how does it stay linked to the parent, and not just become a parent of its own.

    does code in the child theme take priority over the parent theme? – if so why bother having a parent theme… if there’s a crucial update needed and you have code that blocks it then you won’t benefit from that important update.

    how do you edit/add information to child themes? I used a plugin to create my child theme and whenever I go to editor the only available edit I can make is under “Styles – Stylesheet (style.css)” and even in that form it is blank. How do I add more sheets? I’m not a coder so I don’t really know, but I would like to make a few adjustments here and there without every update getting rid of them.

    I’m new to website building and am really trying to figure this all out.

Viewing 9 replies - 1 through 9 (of 9 total)
  • doubleedesign

    (@doubleedesign)

    if I make the child theme the permanent theme/activate it, how does it stay linked to the parent, and not just become a parent of its own.

    At the top of your child theme’s style.css, where you put the theme name etc, you need an extra line to specify this:
    Template: parent-theme-directory-name

    does code in the child theme take priority over the parent theme?

    Yes. For example, if your child theme has a page.php, that will be used. If it doesn’t, then the parent theme’s page.php will be used.

    The exception to this is functions.php. If a function in the parent theme’s functions.php is not explicitly removed/overwritten in the child theme, it will still be run/available as called.

    why bother having a parent theme

    You only copy over the files that you actually make changes to, not all of them.

    if there’s a crucial update needed and you have code that blocks it then you won’t benefit from that important update

    This really depends on what changes you make and what the parent theme’s updates contain. Occasionally you may need to make changes yourself in line with what the original theme author has done, but I have found this to be fairly rare myself.

    how do you edit/add information to child themes?

    How do I add more sheets?

    If you need to copy/add more files, you will need to do this in a code editor and upload them via FTP or your hosting control panel. You cannot do this via the theme editor inside WordPress – the latter only allows you to edit existing files.

    Thread Starter willc93

    (@willc93)

    Ahh ok that makes more sense! I’ll probably just add the CSS(?) to the stylesheet in the child theme for now and in time do it via the FTP as I learn more about it.

    One more quick question about child theme (sort of). If I want to remove a line of code from the parent theme, how would I do that in the stylesheet of the child theme? Right now I’m just changing font colors and sizes in the child theme. I was able to remove the code I didn’t like in the parent, but I feel like it would be better to remove it via the child. Would it be as simple as saying remove -…. ?

    doubleedesign

    (@doubleedesign)

    If I want to remove a line of code from the parent theme, how would I do that in the stylesheet of the child theme?

    This depends what you mean by remove a line of code. If you mean CSS code, then you can just overrwrite that property in your child theme’s style.css to “undo” it. If you mean HTML code, you may be able to “hide” it in CSS, but the ideal solution to actually remove it is copying over and editing the relevant template. What exactly are you trying to remove?

    Thread Starter willc93

    (@willc93)

    I am trying to remove this line:
    ?php tesseract_footer_branding(); ?

    from the Theme Footers (footer.php) Template.

    It’s a branding piece to the footer of the theme – removing it should not harm the theme itself.

    I have it removed in the template of the parent theme, but if an update is given for the parent theme, won’t it reappear?

    doubleedesign

    (@doubleedesign)

    I am trying to remove this line:
    <?php tesseract_footer_branding(); ?>

    You should do this by copying footer.php into your child theme, and removing it from that file. Then it will not get overwritten when you update your parent theme.

    Thread Starter willc93

    (@willc93)

    Just tried that and it didn’t seem to work. Only when I remove it from the parent theme does it remove it. I copied and pasted the entire Footer Theme code then removed that line and nothing seemed to change.

    On another note – had this worked – it would be a better idea to create its own Template and remove it there, and not in the stylesheet right? Is the style sheet just for general changes sort of area?

    doubleedesign

    (@doubleedesign)

    it would be a better idea to create its own Template and remove it there

    Yes, this is what you need to do. Forget about the stylesheet for now, that’s not where you need to make this type of change. You need to copy the whole footer.php template and paste it into your child theme, so your child has a file called footer.php that is exactly the same as the parent theme’s footer.php. Then, remove the code you don’t want from your child theme’s footer.php.

    Is the style sheet just for general changes sort of area?

    The stylesheet is only for CSS changes, not removal of actual markup or content. Things like changing fonts, colours, type of bullet used in a list, and changing the spacing below a widget are examples of things you should do in style.css.

    Adding or removing HTML markup or sections of content should be done in .php files. Some users will say to just display:none in the CSS but to me this is a hacky workaround, search engines can still see it and users could see it if they turned of CSS or it didn’t load, so if you don’t want it, actually remove it from the template.

    Thread Starter willc93

    (@willc93)

    how do you edit/add information to child themes?

    How do I add more sheets?

    If you need to copy/add more files, you will need to do this in a code editor and upload them via FTP or your hosting control panel. You cannot do this via the theme editor inside WordPress – the latter only allows you to edit existing files.

    I think I understand. So to add the Footer Template I would need to download a code editor and create the template there, right? I would copy the current information of the footer.php of the parent in the new template via a code editor – which cannot be done on WordPress.

    If that’s the case – what’s a good code editor program to use?
    How do I upload my current child theme to this program? I didn’t create the child theme personally, I used a plugin Child Themify to create it from the Parent theme.

    Once I create the new template (and future templates) would I just upload the entire child theme again every update, or would there be a way to upload just the new information (I don’t see any issues either way, but not sure and don’t want to do something I’m not suppose to)

    doubleedesign

    (@doubleedesign)

    So to add the Footer Template I would need to download a code editor and create the template there, right? I would copy the current information of the footer.php of the parent in the new template via a code editor – which cannot be done on WordPress.

    Yep, that’s correct.

    what’s a good code editor program to use?

    Notepad++ should do the trick for this, it’s free.

    How do I upload my current child theme to this program?

    You will need to download your theme via FTP, Filezilla is a good free tool for this. Depending on your hosting this may be slightly different, but generally it’ll be located in public_html/wp-content/themes or similar.

    You can then use Filezilla to upload your changed files to the server.

    would there be a way to upload just the new information

    Yeah, you can just upload the files you have changed. You could upload the whole theme if you want, it’ll just overrwrite the other files with identical copies so it makes no difference. For clarity it’s good to just upload files you know you’ve changed.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘ELI5 – What it the point of a Child theme and how do you use it’ is closed to new replies.