How to make a Child Theme

Creating a Child Theme

First step in creating a child theme is to create the child theme directory that will be placed in wp-content/themes. This ensures that your hard work is not overwritten by a future topic update. Creating a Child Theme in WordPress When you' ve been a theme designer (or even an optimizer) for some considerable amount of now, you will know how important it is to use a child theme when you build on an already established design (rather than recreating your own from scratch). When you make changes to the theme's file (e.g.

something in the "/themes/yourthemename/" directory), these changes are likely to be superseded the next times the theme is updated.

Parent Design allows you to establish a separate folder where you can make and customize a copy of a design's file without worrying that your work will be overwhelmed by further updating. Indeed, a whole children's theme audience has evolved from pop art framework such as Thesis and Genesis.

Luckily, making a child design is child's play - all you have to do is make a subfolder and a filename. Your website must be accessible either via FTP or the web host's web host management software. It contains one or more directories, each of which is a theme that has been set up on your website.

Make a new subdirectory in this subdirectory. Name it as you like, but I would suggest using a generic name like "parenttheme-child" (where "parenttheme" is the name of your current theme). You can see that my theme is "twentyeleven", so I put it in a file called "twentyeleven-child".

After you have finished creating your folders, you need to insert the only filename needed to make a child theme work - style.css. Undoubtedly, as you have guessed, these files will work as a supplement to the theme of your superordinate theme. bss-files. You need to insert some important information into this filename, so open your preferred text editors and insert the following into an empty file:

It is a user-defined child design that I have made. You only have to change one of the variables to make your child theme effective - "Template". You need this to tell your child theme which theme it belongs to, and you must change it to reflect the name of the current design group.

By uploading this filename in its present state and activating your child design, WordPress would consider the styles of your child design. See your custom theme filename as the standard theme filename and nothing. Consequently, your design would be rendered without any CSS stenciling. Therefore, you must call the higher-level theme's Styles for your child theme using the appropriate styles in the higher-level theme's CSS files.

The following line of source is in the output of the following script: The following is a line of code: /import url("../parenttheme/style.css"); As with the "Template" variables above, you must modify "parenttheme" to correspond to the name of your superordinate theme. So if the standard style sheet is not style.css (which it almost certainly will be), you will need to modify it accordingly.

Now, if your child theme is enabled, WordPress knows that it must have imported all the styles from the styles of your child theme before it performs a custom saved styles of the child theme. bss files. WordPress will take priority over any previous version of your document because the last thing WordPress does is the CSS it contains in your new document.

As soon as you have added the necessary information in the two sections above, store your new styles. Send the content of the current design to the directory of your child design. The only thing that remains to be done is to turn your child topic on. In your WordPress administration area, browse to Aussehen > Themen. You will see at the top of the display that your superior design is running, but you should also see your new subordinate design below:

Information that you have added to the CSR files of your child theme (for example, Theme Name and Author) is shown on this monitor. Simply click on "Activate" and your child's theme will go first! In this case, your child theme will be shown as the current theme: You will not see any changes to the look of your designs at this point as you have not made any yet.

Nevertheless, all your children's theme's styles will have an impact in the years to come. Your website will be influenced by this. And, as planned, any forthcoming upgrade of your higher-level design will not influence the look of your lower-level design. bss-document. To make a modification to a particular PHP in your higher-level theme, simply make a copy of it and insert it into the folder of your lower-level theme.

All changes you make go first. Simply add the new filename to the folder of your child theme, add the information you need and you're ready to go. A thing to keep in mind is that the tree in your child theme should be the same as the one in the theme. So, if you choose to modify a given script in " /parenttheme/includes/external/php/example.php", you should place it in " /childtheme/includes/external/php/example.php".

Now you can see that making a child topic is very easy, and you have no justification for not doing so. If you' re just making a few small optimizations, it's worth spending a few moments to create a child design so you don't get any bad things when the next design upgrade runs.

Auch interessant

Mehr zum Thema