Technical
Building Your First WordPress Theme with AI Agents
Building a WordPress theme used to take a week of PHP, CSS, and template file wrestling. You had to learn the template hierarchy, understand the loop, register menus and widgets, and write responsive CSS by hand. With Claude Code, I built a production-ready theme in four hours. Here is the workflow.
The Traditional Pain
A WordPress theme requires a surprising number of files and registrations:
style.csswith theme metadata (name, version, description)functions.phpfor hooks, filters, and feature registration- Template files:
index.php,single.php,page.php,header.php,footer.php - Theme support declarations (menus, featured images, widgets, custom logo)
- Responsive CSS for mobile, tablet, and desktop
- WordPress coding standards compliance (escaping, translation functions)
That is a lot of boilerplate before you even touch the actual design.
The Agentic Workflow
Step 1: Describe the Theme
I give Claude Code a clear brief with business requirements:
'Build a WordPress theme called Starter Clean with a minimal mobile-first design, support for custom logo, navigation menus, and featured images, a blog listing page with excerpts and pagination, a single post template with author info and publish date, a responsive grid layout using CSS Grid, and no external CSS frameworks.'
Step 2: Let the Agent Scaffold
Claude Code creates the complete file structure:
starter-clean/
style.css
functions.php
index.php
single.php
page.php
header.php
footer.php
sidebar.php
template-parts/
content.php
content-page.phpStep 3: Review and Iterate
'The header needs a sticky navigation bar that becomes compact on scroll. And the footer should have three widget areas arranged in a grid layout.'
The agent updates header.php, footer.php, and functions.php to register the new widget areas. Each iteration takes under a minute.
Step 4: Test in WordPress
# Copy theme to WordPress themes directory
cp -r starter-clean/ /path/to/wordpress/wp-content/themes/
# Activate via WP-CLI
wp theme activate starter-cleanWhat the Agent Handles Well
- Boilerplate: Template tags, the WordPress loop, function registrations
- Responsive CSS: Media queries, grid layouts, flexbox alignment
- WordPress standards: Proper escaping with
esc_html(), translation functions, hook usage - Accessibility: ARIA labels, semantic HTML structure, skip-to-content links
What You Still Need to Do
- Design decisions: Colors, typography, spacing, visual hierarchy
- Client customization: Which options to expose in the WordPress Customizer
- Performance testing: Check actual load times with real content and images
- Security review: Verify proper data escaping and input sanitization
Why This Matters for Consultants
Client projects often need a custom theme tailored to their brand. With agentic development, the theme development cost drops from days to hours. That time savings translates directly to better margins on every project.
See the WordPress Theme Developer Handbook for standards and best practices.
RELATED READING
The Consulting Shift I Am Making In Year Two
After a year of writing and building, my consulting practice is changing shape. Shorter engagements. Sharper outcomes.
ReadThe Frontend Shift: Shipping Less JavaScript In Year Two
A year ago I reached for Next.js for everything. This year I often reach for nothing.
ReadThe Serverless Lesson I Would Write On A Sticky Note
After a year of shipping serverless projects, one rule explains most of the wins and all of the losses.
Read