Introduction to Templates

Like nearly all content management systems, WordPress uses a templating system to handle the output of content on the front end of a website. In modern block themes, templates are HTML files with block markup.

In this document, you will learn how the templating system in WordPress works. After that, you can jump ahead to the more detailed Templates and Template Parts documentation.

What are templates?

In a nutshell, templates take dynamic data and wrap it into structured HTML markup, which is then sent to the browser. It is not a particularly revolutionary concept, and it is one that nearly every website system with dynamic data uses.

 The templating system in WordPress does a few important things:

  • Parses block markup, which is used to reference static and dynamic data.
  • Retrieves dynamic data (e.g., post content, site options, etc.) from the database.
  • Sends the resulting HTML to the visitor’s browser.

The major difference between WordPress and most other platforms is the inclusion of block markup. Block theme templates are made entirely of blocks, which can both represent static or dynamic data. The WordPress templating system parses these blocks to ensure they output the correct content when it is sent to the visitor’s browser.

Another thing that WordPress does well is provide a visual interface to build or customize templates directly from the admin: