Template-based dynamic content generation using spintax markup for WordPress.
spintax.net · WordPress.org (pending review)
- Enumerations
{a|b|c}— randomly pick one option, with unlimited nesting - Permutations
[<config>a|b|c]— pick N elements, shuffle, join with custom separators - Variables
%var%— global, local (#set), and shortcode-level scopes - Nested templates — embed templates via
#includeor[spintax]shortcode - Object cache — rendered output cached via WP Object Cache API (Redis/Memcached ready)
- Cron regeneration — optional scheduled cache refresh per template
- Validation — bracket matching, circular reference detection, syntax checking on save
- Live preview — renders current editor content without saving
- Admin UI — code editor, shortcode copy, settings page with global variables
Syntax based on the GTW (Generating The Web) standard.
Go to Spintax → Add New in the WordPress admin:
#set %product% = {Widget|Gadget|Tool}
#set %features% = [<minsize=2;maxsize=3;sep=", ";lastsep=" and "> fast|reliable|affordable|portable]
{Introducing|Meet} the %product% — it is %features%.
Shortcode (in posts/pages):
[spintax slug="my-template"]
[spintax slug="my-template" product="Custom Name"]
PHP (in theme files):
echo spintax_render( 'my-template', [ 'product' => 'Custom Name' ] );Each page load produces a unique variant:
Meet the Gadget — it is reliable and portable.
Introducing the Widget — it is fast, affordable and reliable.
| Syntax | Description | Example |
|---|---|---|
{a|b|c} |
Enumeration — pick one | {Hello|Hi|Hey} |
{a|{b|c}} |
Nested enumeration | {big|{very|super} big} |
{|a|b} |
Empty option | sometimes nothing |
[a|b|c] |
Permutation — all, shuffled | [x|y|z] → y z x |
[<sep> a|b] |
Custom separator | [< and > a|b] → b and a |
[<config> a|b|c] |
Configured permutation | [<minsize=2;sep=", "> a|b|c] |
%var% |
Variable reference | Hello %name%! |
#set %var% = val |
Local variable | #set %color% = {red|blue} |
/#...#/ |
Block comment | /# note #/ |
#include "slug" |
Embed template | #include "header" |
Settings → Spintax:
- Global Variables —
#setsyntax textarea, available to all templates - Default Cache TTL — seconds (0 = no caching)
- Access Control — allow editors to manage templates
- Debug Mode — log rendering errors
Per-template (meta boxes):
- Cache TTL override
- Cron schedule (hourly / twicedaily / daily)
- Regenerate public cache
- Live preview with validation
npm run env:start # Start wp-env (localhost:8892)
npm run test:php # PHPUnit (153 tests)
npm run lint:php # PHPCS (0 errors, 0 warnings)
npm run version:set -- X.Y.Z # Bump version everywhereGPL-2.0+ — see LICENSE.