Custom theme, part 2: Two ways of building WordPress themes

Lesson#5 of 6 in topic Theory

There are basically two big approaches to building WordPress themes:

  1. ๐Ÿง“ Classic (PHP template-based themes)

  2. ๐Ÿ†• Modern (Block / Full Site Editing themes with HTML templates)

Letโ€™s break them down properly.



1๏ธโƒฃ Classic WordPress Theme (PHP Template System)

This is the โ€œold-schoolโ€ but still very widely used method.

Structure

A classic theme consists of PHP files like:

style.css index.php header.php footer.php sidebar.php functions.php single.php page.php archive.php

๐Ÿ”ง How it works

  • WordPress uses Template Hierarchy

  • It loads different PHP files depending on the request:

    • single.php โ†’ blog post

    • page.php โ†’ page

    • archive.php โ†’ category/archive

  • You split layout into parts:

    <?php get_header(); ?> <?php get_footer(); ?>

Each part is a PHP file.


๐Ÿ’ก What you build with

  • PHP (core logic)

  • HTML

  • CSS

  • JS

  • WordPress hooks (add_action, add_filter)

  • Template tags (the_title(), the_content())


โœ… Pros

  • Full control

  • Mature ecosystem

  • Tons of tutorials

  • Perfect if you like backend logic (you probably would ๐Ÿ‘€)

โŒ Cons

  • Mixing PHP + HTML can get messy

  • Harder for non-devs to edit layouts

  • Less visual editing


2๏ธโƒฃ Modern WordPress Theme (Block / FSE Theme)

This is the new approach introduced with Full Site Editing in WordPress 5.9+.

Instead of PHP templates, you build themes with:

  • HTML template files

  • Block JSON config

  • Reusable block components


Structure

Typical structure:

style.css theme.json templates/ index.html single.html page.html parts/ header.html footer.html

Notice something?

๐Ÿ‘‰ Templates are .html, not .php.


๐Ÿ”ฅ How it works

Instead of PHP functions like:

<?php the_content(); ?>

You use block markup:

<!-- wp:post-content /-->

Everything is a block.

Header, footer, query loops โ€” all blocks.

WordPress parses this block HTML and renders it dynamically.


๐Ÿง  Core idea

Layout = Blocks
Design system = theme.json
Templates = HTML with block markup

You donโ€™t write PHP for layout anymore.


๐Ÿ’ก What you build with

  • HTML

  • Block comments (<!-- wp:... -->)

  • theme.json (design system)

  • Optional custom blocks (React if advanced)


โœ… Pros

  • Cleaner separation of structure & logic

  • Visual editing in admin

  • Reusable block patterns

  • Future direction of WordPress

โŒ Cons

  • Less raw control than classic PHP

  • More abstract

  • Can feel โ€œmagicalโ€

  • Still evolving ecosystem


๐Ÿ†š Side-by-Side Comparison

Classic ThemeBlock Theme
PHP templatesHTML block templates
get_header()template parts via blocks
functions.php heavytheme.json heavy
Dev-focusedEditor-focused
Backend logic flexibleFrontend editing flexible

๐Ÿง  Which One Should You Care About?

Since youโ€™re a developer who likes structure and control:

  • If you want deep backend logic and customization โ†’ Classic PHP themes

  • If you want modern architecture & product-oriented flexibility โ†’ Block themes