Business Websites Forums General WordPress Using a WordPress Child Theme

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1028
    Angela
    Keymaster

    Why should you use a child theme before making modifications to your theme files? For the simple reason that as soon as that theme is updated, all of the files are overwritten and you will lose any modifications. Also, if you do make modifications that end up ‘breaking’ your site, you should have a fairly good idea of what went wrong and be able to track down the error.

    If you are using a child theme, WordPress will check your child theme first to see if a specific functionality exists. If it doesn’t, it will use the parent theme. This is great because it allows you to modify only what you need.

    Supposing you are using the theme ‘Twenty Seventeen’ and want to use a child theme, then you would need to follow these steps, but remember to change the theme details to the theme you will be using on your own blog.

    First, via FTP, create a new folder within your themes directory. For example, I would create this folder: twentyseventeen-child

    Now create a file using any text editor called style.css

    and paste the following into it:

    [pastebin id="YPFzZ5ft"]

    This file stores the information regarding your child theme, as well as telling it where to look for the parent them. Please change the details according to your new child theme.

    Upload this file into the folder you just created, and then create another file called functions.php. In this, paste the following:

    [pastebin id="kXwy563G"]

    Your child theme will first load the contents of any files located under it, and then look for other files in it’s parent theme. So, for example, if you wanted to change or add code to comments.php or single.php, you would copy these files from the parent theme to the child theme folder and edit them from there.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.