WHMCS 8.1 introduces a powerful new functionality for Client Area themes and Order Form templates that allows for parent-child relationships. Themes control the look and feel of the Client Area interfaces in WHMCS. Customizing them lets you provide a seamless experience for your customers by matching your company's branding in the WHMCS Client Area. Order Form templates, on the other hand, control the way the products and cart appear when your customers make purchases.
Our new and expanded system for parent-child relationships allows you to apply customisations by only overriding the template files you wish to change. This drastically reduces the number of files that you need to create for a custom template. This, in turn, makes it easier to track, maintain, and manage your custom templates during updates, minimizing the amount of time you spend on both initial development and updates. That's why we're making child themes the recommended method to customize WHMCS's Client Area in WHMCS 8.1 and later.
Parents and ChildrenParent
themes include files, dependencies, or other assets that child
You can create very simple child themes for many purposes. For example, you could add a site tracker to the footer of a default theme using only the
file and a
file, or you could pair
file to provide additional contact information to users. Once you're using your new system theme or order form in the WHMCS interface, WHMCS will use the files in your custom template, if they exist, and then pull the remaining files from the parent theme, creating the final look and feel of your Client Area. This drastic reduction in customized files will save frontend developers time, both during development and when maintaining the theme and upgrading to new WHMCS versions.
For child themes, all you need is a new directory, a
file, and copies of the files you want to customize or override.
Creating a Child Theme
It's easy to make a child theme. Just follow these steps:
1. Start by creating a new directory within the templates directory. The directory name can only contain lowercase letters, numbers, hyphens, and underscores.
2. Create a
file. This will indicate that the theme is a child theme by specifying the parent theme to use. For example:
description: "My Company's Branding"
author: "Hosting Company, L.L.C."
file has many options, but it must contain, at minimum, the theme name (to display in the interface) and the parent theme's directory name.
3. Create a
file. If you plan to make any CSS-related changes, you will need to create this file. If you won't be touching any CSS, you can skip this step. For example, to customize the background color in the Client Area, you could add these lines to a newly-created
// Example override for the primary background color
4. Make your customizations. We recommend copying the necessary files from the parent theme if you're using an existing file. For example, to update the footer, copy
from the parent theme into your new theme's directory.
With just those few changes, your theme will be ready to preview and then start using. You can preview themes by appending
to the URL for your Client Area, making sure, of course, to replace
with your theme's directory name.
Choosing a theme
In the WHMCS interface, you can select your default theme at Configuration > System Settings > General Settings
in the General
tab. The list of themes in the System Theme
menu will automatically include the two WHMCS-shipped default themes (Six and Twenty-One) as well as any custom themes that you've saved to the templates directory.
WHMCS will automatically check for any incompatibilities between your selected theme and the order form templates you use, ensuring a good experience for your customers. If there are incompatibilities, the WHMCS interface will display a warning in the interface and will update your settings to use a compatible order form template. Compatibility checks will only find incompatibilities, however, if the theme developer made use of the new theme dependencies feature.
Existing system themes and order forms
If you already have an existing theme or order form in place, there's no special update required for continued use beyond the usual maintenance for changed template files in the version. It will keep working as though nothing has changed when you upgrade to WHMCS 8.1. If you have time for updates, though, leveraging these changes could save you time and effort later in maintaining your customizations.
Ready to try the new system? You can find more information on developing custom themes, including new Smarty functions and code examples, in our Developer Documentation
Liked this article? Share it