WTR arises from the need to have a tool for quickly creating small WordPress sites while maintaining the backend, which customers are so attached to. It aims to solve well-known issues encountered over the years of developing in Typescript:
- Achieving a partial form of server-side rendering;
- Improving SEO/Crawlers performance;
- Optimizing the use of assets, chunk splitting, etc.;
- Avoiding the need to reconfigure Webpack (or your preferred bundler) from scratch every time.
WTR is nothing more than an npm-installable package through the command:
npm i @hund-ernesto/wtr
It contains:
- A preconfigured bundler (Webpack) ready to use (also in watch mode)
$^{1}$ ; - A script that prerenders the WordPress PHP theme templates using the
renderToString()
function from react/server; - Some React Hooks to interact with various WordPress features (such as menus or multilingual plugins);
- A router that allows updating page metadata by directly taking data set by Yoast;
- Default support for ACF.
Disclaimer: The features made available for WTR are tailored to our way of development and our stack of plugins/technologies. If you need further information regarding support for unlisted plugins, contact us at developer@hund.studio.
WTR is a way to quickly develop a site without worrying about WordPress, Typescript, or React, focusing only on what matters.
Being a WordPress theme, most plugins that can be installed on WordPress can also be used with WTR. However, some plugins that modify/intervene on the frontend may conflict with the hybrid Server Side Rendering system and cause total or partial malfunction. In general, our policy is: the fewer plugins, the better for everyone...in the world.
Here are the plugins directly integrated into WTR that can provide various useful functionalities:
- Advanced Custom Fields;
- qTranslate-XT;
- Yoast SEO.
Disclaimer: In the case of particularly useful plugins, we can consider integrating them. Write to developer@hund.studio.
- WTR only works with Typescript, not Javascript. So, if you are not already using it, get on board;
System requirements:
- A working installation of WordPress (local or remote);
- Node.js 18.17 or later.
We recommend starting a new wtr project using the init
command, which sets up everything automatically for you.
To create a project, run:
npx @hund-ernesto/wtr init
After the prompts, init
command will create a folder named website
, install the required dependencies and build the starting theme that you will upload to your Wordpress installation.
Good to know:
- You must upload it like you would normally do for any other Wordpress theme: inside the
wp-content/themes/
directory.
Before being able to start you need one additional step: update the generated .env
file with the URL of your Wordpress installation.
# ./env
WP_HOST="http://yourlocalwordpress.local"
wtr can run with 2 different modes.
Watch mode is useful when developing on a local Wordpress installation.
You can symlink _out/wp-theme
to your /wp-content/themes
and start working on your template.
npm run dev
This mode is suggested if you need to directly work with custom Wordpress functionalities (for example register custom REST endpoints).
Serve mode is useful if you have to interact to a remote Wordpress installation with real data on it.
npm run start
Ready to publish online? use npm run build
command to bundle and compile your Wordpress theme.
You will find your theme inside the _out
folder in your project root.