>> SYS_STATUS: OPTIMAL >> NET: SECURE_ENCRYPTED
>> TRACK: TELEPORT
00:00:00 UTC

My First Adventure Building a WordPress Theme with Local AI (Ollama Edition)

I’ve been building websites for years, but recently I decided to run a personal experiment: Can open-weight models running entirely on my own hardware build a custom, production-ready WordPress block theme from scratch?

Equipped with a local development setup, VS Code, and Ollama, I set out to turn a blank directory into a modern block theme. Along the way, I discovered that the key to local AI success isn’t finding one single “perfect” model—it’s knowing when to switch between smaller, faster models and larger, heavier ones depending on the task complexity.

The Goal & Local Architecture

Modern WordPress development has shifted toward Block Themes (Full Site Editing). Instead of writing endless loops in legacy PHP files like header.php or archive.php, modern themes rely heavily on:

  • A central configuration file (theme.json) controlling global styles, color palettes, spacing presets, and editor defaults.
  • HTML block templates (templates/index.html, templates/single.html).
  • A lean functions.php file dedicated solely to registering block patterns and enqueuing stylesheets.

My goal was to test how open-source models handle every phase of this architecture, from deep JSON configurations to PHP hooks and custom utility CSS.

Strategy 1: Fast & Lightweight for Scaffolding (qwen3:8b / qwen3.5:9b)

When starting a project, fast iteration beats deep reasoning. For boilerplating, quick utility CSS, and initial file structures, smaller models running locally are unbeatable.ollama run qwen3.5:9b

Where Lightweight Models Excel:

  • Rapid CSS & Utility Styling: Need a quick CSS grid layout or a flexbox wrapper for a custom block style? A smaller model outputs this instantly with zero latency.
  • Simple PHP Functions: Generating routine WordPress functions—like add_action('wp_enqueue_scripts', ...) or registering a basic block pattern array—is straightforward and well within the capability of smaller parameter models.
  • Inline Autocomplete: Keeping a sub-10B model loaded in the background gives you near-instant code completion without draining your system RAM or slowing down your editor.

The Limits:

When I asked a ~9B model to write a full theme.json file with nested color palettes, fluid typography formulas, and custom layout constraints all in one go, it occasionally dropped trailing commas or lost track of deeply nested bracket pairs.

Strategy 2: Stepping Up to Mid-Weight Reasoning (qwen3:14b)

When syntax precision and structured schemas become mission-critical, it’s time to scale up the parameter size.ollama run qwen3:14b

Where 14B Models Win:

  • Flawless theme.json Generation: Writing theme.json manually is famously finicky; a single schema mistake or misplaced comma disables the entire WordPress Site Editor. The 14B model demonstrated significantly better attention to nested schema structures, generating clean, valid theme configurations without syntax hiccups.
  • Block Pattern Markup: Converting raw HTML layout ideas into valid Gutenberg block comments (<!-- wp:group {"style": ...} -->) requires exact formatting. The 14B parameter model handled these long, comment-heavy block structures effortlessly.
  • Debugging & Refactoring: When a style failed to inherit correctly in the block editor, the 14B model was able to analyze both the CSS and theme.json simultaneously to pinpoint specificity conflicts.

The Model-Swapping Workflow Matrix

Task Complexity Recommended Local Model Why It Works Simple CSS & HTML Markup Compact Model (~8B–9B) Blazing speed, low VRAM usage, instant feedback Standard PHP Hooks & Helpers Compact Model (~8B–9B) Handles familiar WordPress API patterns easily theme.json Architecture Mid-Weight Model (~14B+) Superior JSON schema tracking and structural accuracy Complex Gutenberg Block Patterns Mid-Weight Model (~14B+) Precise handling of block markup comments and attributes

Lessons Learned

  1. Match model size to cognitive load: Don’t waste system resources running heavy models for simple CSS fixes, and don’t expect lightweight models to draft complex, nested JSON schemas on the first try.
  2. Local development means zero latency & complete privacy: Building an entire theme completely offline via Ollama means no API costs, no network delays, and total control over your codebase.
  3. Use a JSON linter regardless: Even with a capable 14B model, keeping a JSON validator active in VS Code saves time when tweaking long theme configurations.

Developing a WordPress theme with local AI didn’t replace the need to understand theme architecture, but learning to switch models dynamically transformed my workflow into a fast, flexible, and completely self-contained dev environment.