Skip to content

Cookie settings

Choose which kinds of cookies you allow. You can change your choice at any time via Cookie settings at the bottom of every page. Privacy statement

Necessary

Always on

Needed to log in, keep your cart and remember your choices. These are always on.

Which cookies?
  • weboke_sessie, weboke_klant, weboke_remember: your session and staying logged in
  • weboke_basket: your cart
  • wkBtwIncl: showing prices with or without VAT
  • wok_cookies: your cookie choice, 12 months

Measures which ad leads to a visit or order, so we do not pay for ads that do nothing.

Which cookies?
  • Google Ads via Google Tag Manager (_gcl_au, _gcl_aw), up to 90 days
  • OpenAI Ads, ads in ChatGPT
  • wok_aff: which partner referred you to us (affiliate programme), 60 days

4.6

Country and language

Each country has its own site, with prices and VAT for that country.

View

Creating a child theme for your WordPress theme

If you edit a theme's files directly, your work is lost with the next update of that theme. A child theme prevents that. It's a small theme that inherits everything from another theme, the parent theme, except what you add to it yourself. You can keep updating the parent theme as usual. Here you'll read when you need a child theme and how to create one with File Manager in DirectAdmin.

Do you need it?

You want toChild theme needed?
Customise a block theme in the Site Editor (Appearance > Editor): colours, fonts, header and footerNo. Those changes are stored in the database and stay in place after an update.
Add a few lines of CSSNo. Use Additional CSS in the Customizer (classic theme) or under Styles in the Site Editor.
Add a feature that has nothing to do with the design, such as an integration or formNo. That belongs in a plugin, so it keeps working after you switch themes.
Change a template file of the theme, add a lot of custom CSS, or add PHP code related to the designYes.

Using a block theme? Then try the Site Editor first. If you want to save your Site Editor changes to files, the official Create Block Theme plugin can create a child theme for you.

Switching themes on a busy site can get a bit messy: menus, widgets and Customizer settings apply per theme. So do it on a copy first, see Creating a WordPress staging environment, or at least make a backup beforehand.

Step 1: find your parent theme's folder

  1. In DirectAdmin, open File Manager. See Opening File Manager: the folders in your package.
  2. Go to domains/example.com/public_html/wp-content/themes.
  3. Write down the exact name of your theme's folder, for example hoofdthema. It's the folder name that matters, not the name you see in WordPress.

Step 2: create the folder and style.css

  1. In the themes folder, click New Folder and create, for example, hoofdthema-child.
  2. Open that folder, click New File and create style.css.
  3. Right-click the file, choose Edit, paste the header below and click Save.
/*
Theme Name:   Hoofdthema Child
Template:     hoofdthema
Description:  Eigen aanpassingen voor example.com
Version:      1.0.0
*/

/* Je eigen CSS komt hieronder. */

The Template: line is the most important one. It must contain the exact folder name of the parent theme, with the same capitals and hyphens. If it's wrong, WordPress will report that the parent theme is missing.

Step 3: functions.php or theme.json

Classic theme: in the same folder, create a functions.php that loads your stylesheet:

<?php
add_action( 'wp_enqueue_scripts', function () {
    wp_enqueue_style(
        'hoofdthema-child',
        get_stylesheet_uri(),
        array(),
        wp_get_theme()->get( 'Version' )
    );
} );

Whether the parent theme loads its own stylesheet differs per theme. Check your theme's documentation. If your site looks bare after activating, you also need to load the parent's stylesheet, using get_template_directory_uri() . '/style.css'. The child's functions.php doesn't replace the parent's: both are loaded, the child first. So never copy functions from the parent's functions.php, because duplicate function names cause a critical error.

Block theme: you usually don't need a functions.php. If you want a different colour palette, for example, create your own theme.json. WordPress merges it with the parent's, so you only include what you want to change.

If you want to modify a template, copy only that one file from the parent to the same location in your child and edit the copy. WordPress looks in the child first and then in the parent. Don't copy everything, or you'll stop receiving the parent's improvements.

Step 4: activate

  1. In WordPress, go to Appearance > Themes. Your child theme is listed there. Click Activate.
  2. Check your site: header, menus, widgets and colours. If needed, set up your menus and Customizer settings again.
  3. Keep the parent theme installed and up to date. The child won't work without its parent.

Prefer to create the child theme on your own computer? Then zip the folder and upload it in WordPress under Appearance > Themes using the Add New Theme button and then Upload Theme. Or upload the folder to wp-content/themes with File Manager or SFTP, see Uploading and downloading files.

Back to the old theme

Under Appearance > Themes, activate the parent theme again. If an error in your child locks you out of the dashboard, rename the child's folder in File Manager, for example to hoofdthema-child-uit. WordPress will then fall back to a default theme, if one is still installed. More on this in Error 500 or "critical error" on your website (also after a WordPress update).

Further reading

Want to learn more? Take the free WordPress course, lesson 5.2 Creating a child theme.

Was this article helpful?

← Back to General hosting

One moment…

Set up your domains

For each domain, arrange the nameservers, the link to your hosting and who becomes the owner.

Loading your domains…