In this tutorial we will show you how to create custom pages in WHMCS. This guide will focus on our Premium WHMCS Themes but should work with any WHMCS template.

Create the .php page

This page will have all of the functionality required to load the page and assign it the above page title. Luckily this code is provided by WHMCS, however I have simplified their example as much as I could.

Create a new .php file in the root of WHMCS. I always recommend using the page title without spaces and capitations, in this case it will be windows-hosting.php. This file needs to contain the following code:


use WHMCS\Authentication\CurrentUser;
use WHMCS\ClientArea;
use WHMCS\Database\Capsule;

define('CLIENTAREA', true);

require __DIR__ . '/init.php';

$ca = new ClientArea();

$ca->setPageTitle('Your Page Title Goes Here');

$ca->addToBreadCrumb('index.php', Lang::trans('globalsystemname'));
$ca->addToBreadCrumb('mypage.php', 'Your Custom Page Name');


//$ca->requireLogin(); // Uncomment this line to require a login to access this page

// To assign variables to the template system use the following syntax.
// These can then be referenced using {$variablename} in the template.

//$ca->assign('variablename', $value);

$currentUser = new CurrentUser();
$authUser = $currentUser->user();

// Check login status
if ($authUser) {

     * User is logged in - put any code you like here
     * Use the User model to access information about the authenticated User

    $ca->assign('userFullname', $authUser->fullName);

    $selectedClient = $currentUser->client();
    if ($selectedClient) {

         * If the authenticated User has selected a Client Account to manage,
         * the model will be available - put any code you like here


} else {

    // User is not logged in
    $ca->assign('userFullname', 'Guest');


 * Set a context for sidebars
 * @link

 * Setup the primary and secondary sidebars
 * @link

# Define the template filename to be used without the .tpl extension



Note the Windows Hosting, windows-hosting.php and windows-hosting references. These should be changed based on the page you'd like to create.

Create the .tpl page

This last file is where you’ll need to add your content for this particular custom page. It needs to be named exactly in line 35 of the above code but with the .tpl extension. So in this case it is windows-hosting.tpl. This file needs to be created in the following directory:


As a example add the following basic content to this file:

<h2>This is a page title</h2>
<p>This is a paragraph</p>

All of our WHMCS Templates also come with ready-made code which you can copy/paste to instantly add responsive feature boxes, pricing tables etc. You can the code under WHMCS admin > Addons > Wizard Panel > HTML Snippets.

View the new page

The new page will now be viewable at:


If you have any questions please leave a comment below or contact our support.