Last modified: August 22, 2025
If you’re familiar with developing on WordPress and want to create websites on the HubSpot CMS, review the below guide for recreating WordPress themes as HubSpot CMS themes.
For a video walkthrough on developing on both WordPress and HubSpot, check out the YouTube series Getting Started With HubSpot CMS Hub for WordPress Devs:
For support while developing on HubSpot, check out the CMS developer community or join the HubSpot developer Slack. And if you need further assistance in recreating your website or migrating your content to HubSpot, you can request help from a HubSpot partner.
Please note:This guide does not discuss recreating WordPress themes that rely on complex plugins. Depending on the plugins you’re using, HubSpot may provide those functionalities by default. You may also be able to find apps and assets already developed on HubSpot’s marketplace to provide a similar functionality. Alternatively, you may need to develop custom modules or apps.
Converting a theme
To get started, you’ll need to build a theme in HubSpot, then rebuild your WordPress functionality with HubSpot elements:- Install the HubSpot CLI so that you can develop your theme locally.
- Download the HubSpot CMS theme boilerplate by following the steps in the CMS theme boilerplate walkthrough. This walkthrough will teach you the basics of accessing your theme locally, making changes, and sending those changes to HubSpot. You can learn more about HubSpot themes by viewing the themes overview.
- Rebuild your WordPress theme in HubSpot using the reference sections below to learn about the differences between developing on WordPress and HubSpot.
- Once you’ve created your HubSpot theme, import your content into HubSpot.
Building blocks
Both WordPress and HubSpot use a similar framework for architecting themes, templates, and template partials. Below, learn about the differences between each platform’s building blocks, along with example code. You can learn more about HubSpot’s building blocks in the CMS developer documentation.Languages
While HubSpot and WordPress use many of the same coding languages, the main difference is that WordPress sites are built primarily with PHP, while HubSpot themes rely heavily on HubSpot’s templating language HubL. In addition, in Wordpress you might use PHP tags and hooks, while in HubSpot you’ll use HubL filters, functions, and tags. Below, learn more about some of the difference between WordPress and HubSpot languages.WordPress | HubSpot |
---|---|
Stylesheets and JavaScript files can be included in a theme by using wp_enqueue_style() and wp_enqueue_script() . | Stylesheets and JavaScript files can be included in a theme by using require_css() and require_js().In addition, you can include CSS and JavaScript in individual modules to keep the code exclusive to that module. |
Theme styling can be coded using CSS, SCSS, SASS, LESS, and other supersets of CSS. | CSS + HubL can be used to enable variables and macros in your HubSpot theme CSS. |
Returns relative file paths for a theme folder in WordPress with get_template_directory_uri() | Return the public URL of a specific template or coded file with get_asset_url(). |
Create custom functionality with a functions.php file. | The HubSpot CMS doesn’t have an equivalent file, as there is no concept of hooks. However, you can extend functionality with HubL macros, serverless functions, and custom apps. |
Themes
In WordPress, themes often control how the content management system works. For example, a theme can define the custom post types available or which content fields are editable in page templates. In HubSpot, a theme is a collection of developer assets. One HubSpot website might use multiple themes, and updating a theme will only affect the pages that use that theme’s templates. The templates and modules within a HubSpot theme are portable, meaning they can be used in multiple themes, moved between themes, or cloned to create a variation of the asset. Both WordPress and HubSpot share the concept of a single file being used as the starting point for a theme when calling in global partials. In WordPress,index.php
is generally the main file that’s used to call in partials such as header.php
and footer.php
. In HubSpot, the main file is called base.html
.
Below, compare the standard Wordpress index.php
file to HubSpot’s base.html
file.
WordPress index.php
HubSpot base.html
Note that HubSpot’s base.html file includes the following variables:
{{ standard_header_includes }}
{{ standard_footer_includes }}
Templates
In both WordPress and HubSpot, a template is a subset of a theme which determines the page’s layout. In WordPress, the template that’s used to display a page’s content is programmatically determined by the template hierarchy where template file names are named based on their usage. For example, a general post template would be namedsingle.php
. You could then create a new post type with a name that’s relative to that template, such as single-products.php
, where products is the post type.
In HubSpot, the template selection process depends on the type of content you’re creating:
- All posts on a blog will use a single blog template, which you can select in your blog settings. You can use the same template to host your blog listing page, which provides a listing of your blog posts, or you can create a separate template for your blog listing page. Learn more about HubSpot’s blog template markup.
- When building website pages, content creators select which theme template they want to use before creating content. Templates can be swapped out at any time within the page editor.
Template partials
In both WordPress and HubSpot, template partials are individual templates that can be used as components in a theme. In HubSpot, you can create two types of partials:- Standard partials: partials that can be edited at the page-level without affecting other instances of the partial. For example, you might build a standard partial when adding a form if you want the form to be different across landing pages.
- Global partials: partials that update across all pages and templates when their content is updated. For example, you might build a header or footer global partial so that they’re consistent across all pages.
header.php
and footer.php
in HubSpot, it’s recommended to view your header and footer in two ways:
- Locate your
header.php
andfooter.php
files in WordPress. You can usually find these by navigating to Site > WordPress-includes > header.php and footer.php. This may depend on your install, however. - View the rendered header and footer by viewing the page’s source code on a live page, then locating everything between
<head>
and</head>
as well as<footer>
and</footer>
.
Please note:
- To include third-party tracking codes, it’s recommended to re-export them from the vendor, rather than copying directly from WordPress.
- WordPress-specific code is not necessary to copy to HubSpot, including any script from /WordPress-includes/ or /WordPress-content/.
WordPress header.php
Content types
WordPress and HubSpot have different ways of referring to content types. The WordPress content model centers around the post, with different types of content, such as pages and blog posts, categorized as post types. WordPress also allows for custom post types. HubSpot’s content model has a similar hierarchy, but content types are self-described rather than categorized as post types. The main content types that you can build on HubSpot are website pages, landing pages, and blog posts. Outside of website development, you might also build email templates using the CMS. While HubSpot doesn’t have custom content types, you can create custom objects to store data that doesn’t fit into one of the standard content or object categories. Custom objects can be used both within the CRM and for CMS website data. Below, learn about how content types compare across each platform, along with code examples.Pages
In HubSpot, there are two types of pages:- Website pages: the standard page type used for general pages across a HubSpot website.
- Landing pages: the page type best suited for marketing-driven pages, often containing forms. These pages focus on the customer conversion path as a part of the inbound marketing methodology.
page
. Below, view how WordPress’s standard page markup compares with HubSpot’s.
WordPress page markup
Note how HubSpot’s page markup includes
{% extends "./path-to/base.html"%}
. This allows the page’s {% block body %}
block to populate the base.html
file with its contents. It also means that you don’t need to add the standard includes to the page, as base.html
includes them. Learn more about blocks and extends.