WordPress Child Themes Tutorial

WordPress Child Themes Tutorial

Please note that while the theoretical information contained in this tutorial is correct, the example code presented is somewhat outdated and no longer the recommended solution, especially with our latest customizer-based themes.

Do you need a child theme?

If you’re not satisfied with the customization options that the WordPress theme you’re using provides then you have to take matters into your own hands. Even if that theme gives you hundreds of options (like our themes do) there’s still something which probably doesn’t get your boat floating smoothly enough.

Or maybe you’re the extra creative type that really needs to make everything his own and is never satisfied. Or maybe you’re a serial killer, coming from a broken family, with a long history of drug and alcohol abuse and you’re just starting your first blog about hand-crafted torture equipment and we all know how picky serial killers can get. Too specific? Let’s move on.

Why do you need a child theme?

Yes, you can edit theme files directly, but then, when you make an update you’ll lose all your customizations and blame the theme developers for it. Or, option no. 2: you can choose to never update the theme after you make your changes. But that way you lose all future bug-fixes and extra features that come with future theme updates. Not to mention that one day you might completely forget about your customizations and hit that ‘Update’ button without giving it a second thought. Who are you going to blame then, ha? Ha? You’ll need a mirror for this one.

This is why it’s better to never touch theme files and unconditionally love and embrace WordPress’ child themes. It may take 5 minutes out of your life now but it will save you a lot more in the long run.

Can you handle the truth a child theme?

If you want to get things done your way, if you want the ultimate customization power at your fingertips you will have to go the extra mile. Don’t worry, it’s not an actual mile nor a kilometre – it’s more like a couple of yards/meters and we’re here to walk that distance with you. Multiple times if we have to.

Here’s what you’ll need:

  • As you’ll have to add a few files to your server, you’ll need FTP access to the server and a FTP client (we’ll suggest one). This is recommended but not 100% necessary because after creating the child theme folder on your local machine you can archive that and upload it via WordPress (semi-manual installation). More on this later.
  • You’ll also need a text editor to edit those files (we’ll suggest one as well)
  • Basic understanding of CSS and maybe HTML and PHP. But these can be learned as you go especially since you’ll be copy-pasting and editing, not creating things from scratch.
  • A couple of minutes out of your busy blogging schedule

So basically you don’t have to know anything and if child themes sound just like what the doctor ordered and you want to get a solid grip on them, you are welcomed to move on to page 2 of our tutorial. It will take you on a step-by-step journey through WordPress child themes at the end of which you will have a solid understanding of anything child theme related.

If, on the other hand, you just want to create a child theme as soon as possible, we’ve also provided a WordPress Child Theme cheat sheet. It’s a one page go-to resource of everything you need when creating a child themes. So, what will it be? The blue pill or the red one? (actual color names have been changed to protect the identity of those involved)

More Tutorials This article is part of our WordPress general and theme specific tutorials series. For more useful information check out our tutorials section.

38 Comments

  1. Thank you for helping people start in going deeper, I have several of the Cryout Themes and have been very happy with them. I’m having a little trouble.

    I’ve added the folder and css file. I am able to activate the child them
    When I go to my website I see the website but it is distorted, the Main menu seems to be distorted but the presentation page below this is OK.

    This is the code for the style.css

    Theme Name: My WordPress child theme
    Theme URI: http://domain.com
    Description: This is a child theme for the Parabola theme.
    Author: Bob
    Author URI: http://domain.com/me/
    Template: parabola
    Version: 1.0
    */
    @import url(“../parabola/style.css”);

    I suspect the problem is because I am using Parabola-nolink and it’s a “Child Theme”
    so if you are using a “no-link” theme how does that affect things?

    Should the name in the templete reflect that name and be:

    Template: parabola-nolink

    Thank you

    I would add an image of how the wordpress install is distorted but don’t see an option to add images

  2. Hello! If I’m using the Codex theme, which is already a child theme of Rosetta, do I still need to make a child theme of Codex? Or will my customizations within Codex remain even when an update is made to the Rosetta parent theme?

    Here’s another question/anotherway of asking it…

    Will there be regular updates made to the Codex theme itself that I’ll need to maintain? Or will there only be updates made to the Rosetta theme (so I’m safe)?

    Thanks!

    1. Codex is a child theme, you will be able to update its parent Roseta theme safely. However if we ever release an update for Codex itself that would overwrite any file changes you have applied to the child theme. Unfortunately there is no easy way around this as there is no direct support for grandchild themes in WordPress.

    1. We’ll have to update the child themes tutorial (mostly the enqueues and style loading part) for newer standards and include actual child themes examples for all our themes. Hopefully we’ll find the time to do this soon.

  3. Hi guys, I’m working on a Parabola Theme. I can’t able to create a Theme Child. I followed the same routing in the other website i buidl but in the back office I see just a corrupted theme… I can’t explain why. Can you help, please?

  4. Hello,
    Thank you for this great tutorial!
    I am trying to make a child theme on Fluida basis. I need to replace the function fluida_setup() in /includes/setup.php which is hooked to ‘after_setup_theme’. Unfortunately the child function does not get called no matter where I hook it – I tried to init, after_setup_theme, setup_theme… Every time the parent function gets called.

    Here is the code:
    function fluida_setup_featured_imgs() {
    // my custom code goes here
    }

    function child_remove_theme_actions() {
    remove_action(‘after_setup_theme’,’fluida_setup’);
    add_action(‘after_setup_theme’, ‘fluida_setup_featured_imgs’);
    }

    add_action(‘setup_theme’, ‘child_remove_theme_actions’);

  5. Hello, I’m using Mantra theme and currently working for the child theme of it in order to keep my customization. I’ve been following this great tutorial for a while, but got stuck at “parent function removal’ thing and tried different ways in my whole day still haven’t figure it out. Hopefully you would like to help me out.
    For instance, I was trying to modify the display of breadcrumbs, the related function is mantra_breadcrumbs(). So I have done this as follow what you written in tutorial:

    function addon_mantra_breadcrumbs() {
    // My customization code here
    }

    function replace_mantra_breadcrumbs() {
    remove_action(‘cryout_before_content_hook’,’mantra_breadcrumbs’);
    add_action (‘cryout_before_content_hook’,’addon_mantra_breadcrumbs’,0);
    }

    if($mantra_breadcrumbs==”Enable”) add_action (‘init’,’replace_mantra_breadcrumbs’);

    I don’t know why the old function of breadcrumbs is still there…

    1. function addon_mantra_breadcrumbs() {
      // My customization code here
      }

      function addon_remove_mantra_functions() {
      remove_action ('cryout_before_content_hook','mantra_breadcrumbs',0);
      }
      if($mantra_breadcrumbs=="Enable") {
      add_action('init','addon_remove_mantra_functions');
      add_action('cryout_before_content_hook','addon_mantra_breadcrumbs',0);
      }

  6. The attitude of this tutorial is really weird. I don’t think that serial killer joke is very funny, what if I actually did have a long term history of alcohol and drug abuse? It’s not really something to laugh about. I have a lot of friends with serious alcohol and drug problems and a history of abusive families, it doesn’t make them serial killers..it makes them people with difficult problems they are trying to get through. The whole mood of this tutorial is kind of aggressive. I know it’s trying to be funny, but to me the humour is randomly dark and kind of weird. It’s good to have a modern, edgy copy on your website, which breaks the monotony of reading stock standard copy and has a sense of humour…but when it comes to directly insulting the reader, you’re going to lose interest from them. I stopped reading halfway through and just decided to change to a different theme.

  7. Is nirvana-theme able to handle a child-version? I use nirvana-theme and by doing like described in this tutorial, wordpress reports that the child-theme cannot be activated because the parent theme is missing. But both folders exist: β€œMake” & β€œMake-child” and the style.css in the child-folder is like explained above. What can i do?

  8. Hi, sorry would you kindly clarify then:

    If I make my changes in the Nirvana Settings and the Nirvan Custom CSS window…will I LOSE those changes if I update the Nirvana theme in the future???

    If I want to use a font OTHER than Google fonts or the supplied Nirvana fonts, will I need a CHILD THEME?

    and

    Am I able to install other plugins, for example, a Portfolio plugin that I like?? Will I need to have a Child Theme for that?

    I’ve used Child Themes many times with another theme company, where the Child Theme was INCLUDED with the core theme. I made CSS edits, etc. to the Child Theme, and occassonally, some php code (for Excerpts, for example).

    I’ve never used a theme where I had to CREATE a Child Theme, so I am a bit unclear on what happens to the core Nirvana theme changes that I would make under Nirvana Settings.

    thanks very much, great theme, and excellent Forum support!!

  9. Thank you for the info. If all your edits are made in the theme options panels, and the only edits above that are custom css in the custom css section of the theme options panel, is a child theme necessary?

    1. Hi Ryan,

      If theme settings and custom CSS are enough to make your changes then you don’t need a child theme. Only if you need heavier changes like editing actual code, creating new functions etc, then you’d need a child theme.

  10. Just started the tutorial, and got to the point where you recommend FileZilla. Not a bit fan of that program. It stores FTP credentials (site, user name, password) in a plain text file in the user’s folder. Easily accessible by anyone (or any hacker). Big security hole.

    I’d recommend WinSCP. Fully encrypted access, including a master password that you can set up. FileZilla works as an FTP client, but the plain-text user credential file is a big no-no for this computer security dweeb.

    If you want details on the security hole in FileZilla, I wrote about it two years ago here http://securitydawg.com/insecure-filezilla-ftp-program/ . I’ve stopped using it since then. They may have fixed it, but the developers didn’t think it was a problem two years ago, and weren’t going to fix it then.

  11. Is every Theme able to handle a child-version? Might be a silly question, but I bought the “make”-Theme from TheThemeFoundry and by doing like described in this tutorial, wordpress reports that the child-theme cannot be activated because the parent theme is missing. But both folders exist: “Make” & “Make-child” and the style.css in the child-folder is like explained above ….. hm??

    1. We don’t usually answer questions that are not related to our own creations, but themes need to be written to support child theme advanced functionality override. Otherwise, all you’re able to change via child themes is CSS and the standard page/section templates.
      Also, the parent theme name is case sensitive, so “make” and “Make” are two different parent themes.

  12. This is just what I have been needing to educate myself on, Thanks so much! I’ve been able to use theme options for most of the websites I’ve worked on but was really in need of a child theme for my current project and saw the Cryout updates on the Tempera theme options page – it’s like you knew I just needed this short tutorial to acquaint myself with child themes πŸ™‚

    First time using the Tempera theme by the way and I love the adaptability – will definitely be using it again!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.