The Idea#
TemplateX is a WordPress plugin that lets you write theme templates as close to HTML as possible, with WordPress available when you need it.
It is inspired by Statamic's Antlers language and by the desire for a cleaner alternative to Twig and Timber-style WordPress theme authoring. The goal is not to make you think about a framework first. The goal is to keep the page, the markup, and the styling in front of you.
When you need WordPress data, fields, loops, blocks, menus, or hooks, they are still there. TemplateX gives you a smaller, more readable way to reach for them from inside the template.
The philosophy is that theme development should feel like writing the HTML and styling for the site, not like learning every WordPress and PHP quirk before you can build the page.
Authoring And Output#
In TemplateX, most of your theme work happens inside resources/views.
WordPress template files such as single.php, front-page.php, and page.php do not have to sit in one flat folder. Put them where they make sense for the theme you are building.
- front-page.php
- page.php
- single.php
TemplateX finds those source files and turns them into the PHP WordPress expects. You focus on the source view; the generated output stays in the background.
A Small Example#
TemplateX keeps the syntax small, so the page stays visible:
<main> <h1>{{ title }}</h1> {{ content }}</main><?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <main> <h1><?php the_title(); ?></h1> <?php the_content(); ?> </main> <?php endwhile; ?><?php endif; ?>The TemplateX version is only the shape of the page: a main element, a title, and content.
The syntax stays minimal, but it is still powerful. {{ title }} and {{ content }} reach into WordPress without pulling PHP ceremony into the template.
Publish A Standalone Theme#
After you are done developing, run:
npm run publishTemplateX generates a .zip file of your theme. That zip is the compiled version: it works without the TemplateX plugin, does not include the development resources folder, and looks like a theme coded by hand.
For the small example above, the published theme would look more like this:
- style.css
- functions.php
- front-page.php
- build