If you’re familiar with WordPress and want to start developing on HubSpot, learn about some of the differences between the platforms, including example code.
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. |
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.
{{ standard_header_includes }}
{{ standard_footer_includes }}
single.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:
header.php
and footer.php
in HubSpot, it’s recommended to view your header and footer in two ways:
header.php
and footer.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.<head>
and </head>
as well as <footer>
and </footer>
.page
. Below, view how WordPress’s standard page markup compares with HubSpot’s.
WordPress page markup
{% 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.