0

I recently had a problem with my theme due to a plugin. Now its solved but people have been telling me since the problem arrived that i should create a child theme after the prob is solved.

In fact, the theme i bought already has a child theme in its documentation BUT I SOMEHOW FORGOT TO USE IT and was using the parent theme all the while and have been making changes to the parent theme for like 2 months now. Moreover, i have updated the theme for a couple of times as well during that period.

Now my question is: How to add child theme in place of parent theme after using the parent theme till now?

  • Time duration of using parent theme has nothing to do with child theme. You can create child theme any time with minimum of only one file (style.css). A simple google search will tell you, how to create child theme in wordpress. – Rishabh Apr 6 '17 at 6:01
0

Using child themes is a myth that you can live without. If you lived with modifying the parent theme all this time, there is no advantage in switching to use a child theme.

The implied promise of using a child theme is that you will be able to upgrade the parent theme without needing to redo your customizations. Unfortunately, most theme authors do not understand that this imposes a limitation on the amount of changes they should do in the parent theme when releasing a new version, and many times still release versions that break customization even when done in child theme, and this makes the whole concept break.

IMO a better alternative to child theme is to track the changes you have done in git, and when you need to do an upgrade of the base theme, you "just" merge your changes with the ones introduced in the new version.

  • But when we got need to modify any theme's php file then in that case child theme becomes mandatory. Because on update our editing in php file will be removed. – Rishabh Apr 6 '17 at 6:14
  • in theory, but as I say here, in practice many times this will not be enough as themes change the usage of APIs, their HTML output and CSS styling, requiring that you will do the changes again. I am not against using child themes in hope that your theme's author is someone that actually knows what he is doing, I just think that tracking your changes, which is something you should do for your child theme in any case, is as good solution as using child theme. For historical perspective, the concept of child themes were invented long time ago before using version control became easy as is now – Mark Kaplun Apr 6 '17 at 6:24
  • You seems right in your point but the case you are telling is might be the rear case because I have also create child theme for some of my projects so that I can edit some theme's file. And I did update parent theme many times after and I didn't get any need to make my changes again that i have already done in child theme. So the kind of update you are pointing out is rear and I have never face these kinds of update in which I have to make change again in my child theme. Besides child theme saves much times (time that we will spend after update of parent theme to make our changes again). – Rishabh Apr 6 '17 at 6:39
  • it is actually not rare, it is just an indication that either the themes you use are good, or that your customizations are minimal. In a way, the theme authors do not have an incentive to be backward compatible in such a way, as this kind of backward compatibility will prevent them from doing any major modification. The advantage of using git for this, is that merge errors will give you immediate indications of what areas should be re-tested/re-done. – Mark Kaplun Apr 6 '17 at 7:12
0

base on question i think you want to know how to create child theme in wordpress.

I will share you below the steps for that and reference link too.

  • Here is my reference link Click Here

  • steps are given below to create child theme

    // You need to add one folder in theme folder like following 
       parent theme name test then make child theme as test-child
    // then create style.css file in that child folder and add following code.
    
    /*
      Theme Name: Twenty Seventeen child // your child theme name
      Template:   twentyseventeen // parent theme name here
    */
    
    // once this done add function.php file that override parent theme functionality and add following lines in that.
       add_action( 'wp_enqueue_scripts', 'AddParentTheme' );
       function AddParentTheme() {
            wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
       }
    

and you theme is ready, now save both file and check in appereance your child theme is there.

Thanks and hope you get idea using this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.