The right WordPress theme can work wonders when it comes to establishing brand identity and enhancing user experience. But off-the-shelf themes are designed for broad appeal. They can lack the essential personality that the right theme provides ample opportunity to show off.
It’s no secret that this open-source CMS offers excellent documentation for those new to theme development, but how do the pros create a WordPress theme? First, I’ll break down the reasoning behind why there’s such a demand for unique themes, and then provide a crash course on how developers create amazing themes.
Why create your own WordPress theme?
Learning how to create a WordPress theme opens the door to opportunities, especially if you want a website that stands head and shoulders above the crowd.
- Unique design – Most importantly, starting from scratch with a new WordPress theme gives you a blank canvas. Forget fiddling with pre-made templates. Reflect your brand identity just the way you like.
- Optimized performance – Learning how to create a WordPress theme allows you to include only the features you need and avoid bogging down your site with bloat from unused features.
- Tailored functionality – Integrate required specific functionalities right into the theme itself rather than relying on plugins, improving performance and compatibility across your website.
- Better control – Creating your theme gives you complete control over the code. This means you can make updates or changes without being dependent on a third-party theme developer.
- Learning and development – Building a WordPress theme from scratch can be an excellent learning experience. It helps you understand how WordPress works behind the scenes, which can be invaluable for further customization and troubleshooting.
- Security – Custom-coded themes can be more secure than their off-the-shelf counterparts because you have control over every aspect of the theme. Still, it’s up to you to make sure everything’s locked down.
- Scalability – If you create a WordPress theme, you can make it easier to scale as your business or traffic grows.
- Integration – Creating a WordPress theme lets you integrate exactly what you need (like an external API, a specific CRM, or proprietary systems).
Block themes and full site editing in 2025
You might have heard about block themes and full site editing (FSE) in WordPress. Starting with WordPress 5.9, FSE introduced a new way of building themes where everything is built with blocks. Not just posts and pages, but headers, footers, and templates, too.
Block Themes don’t rely on PHP template files the way classic themes do. Instead, they use a theme.json file and block-based templates that can be edited visually inside the WordPress Site Editor. This approach is powerful for designers and no-code workflows, but also requires learning a new theming methodology.
For this guide, we’re focusing on classic themes, which still power the majority of WordPress sites and are essential for understanding how WordPress works under the hood. However, if you’re curious about block themes and want to explore FSE, you can check out WordPress’s official Block Editor Handbook to dive deeper.

Quick tip
1. Preparing your development environment (2025 best practices)
Before you start coding your WordPress theme, you’ll need a local development environment that gives you a safe, private workspace where you can build and test without touching a live website.
Now, depending on who you ask, you will hear wildly different answers about “the best” setup for WordPress dev. Some developers swear by Docker-based workflows and Composer-managed stacks like Bedrock, preferably under version control. These are powerful, scalable tools, but they come with a steep learning curve that makes them overkill for theme development alone. They’re better suited for complex, multi-environment WordPress projects or headless builds.
We’ll focus on the methods that professional developers commonly use for theme development workflows. We want tools that offer flexibility and control, while being straightforward enough for freelancers, agencies, and hands-on learners. We’ll start with the traditional local setup (XAMPP/MAMP) to help you understand the fundamentals, and then I’ll show you how modern tools like LocalWP and DevKinsta can simplify the process.
Setting up a traditional local development environment
Before tools like LocalWP simplified everything with a few clicks, developers used tools like XAMPP (allegedly pronounced “shamp”) and MAMP to set up local WordPress environments manually. While this approach is no longer the golden standard, it’s still a great way to understand what’s happening under the hood when WordPress runs on a web server.
Step 1: Install a local server stack
Since WordPress runs on a web server, you’ll need to install software that replicates a server on your own computer. Traditionally, this includes Apache (web server), MySQL (database), and PHP (scripting language).
- For Windows or macOS: XAMPP
- Download XAMPP from apachefriends.org.
- Run the installer and select Apache, MySQL, PHP, and phpMyAdmin.
- Open the XAMPP Control Panel and start Apache and MySQL.
- Navigate to
http://localhost
to ensure everything’s running.
- For macOS users who prefer MAMP:
- Download the free version of MAMP from mamp.info.
- Install it, launch MAMP, and start the Apache and MySQL servers.
- Visit
http://localhost:8888
to check that the server is live.
Note: If you’re just starting out, XAMPP and MAMP are perfect for getting hands-on with basic PHP and database setups.
Step 2: Install WordPress locally
With your local server running, the next step is to set up WordPress itself.
- Download the latest version of WordPress from wordpress.org.
- Extract the .zip file and rename the folder (e.g.,
mythemeproject
). - Move this folder to:
- For XAMPP:
C:\xampp\htdocs\
- For MAMP:
/Applications/MAMP/htdocs/
- For XAMPP:
Step 3: Create a local database
WordPress needs a database to store content and settings. Both tools use phpMyAdmin for database management.
- For XAMPP users: Go to
http://localhost/phpmyadmin/
. - For MAMP users: Visit
http://localhost:8888/phpMyAdmin/
.
Create a new database (e.g., mytheme_db
). Don’t forget to set up a database user and note the credentials. You’ll need it to configure WordPress.
Step 4: Complete the WordPress installation
- Open your browser and navigate to:
- XAMPP:
http://localhost/mythemeproject/
- MAMP:
http://localhost:8888/mythemeproject/
- XAMPP:
- You’ll see the WordPress Setup Wizard. Enter the following database details:
- Database Name:
mytheme_db
- Username:
root
- Password:
- XAMPP users: Leave it empty.
- MAMP users: Enter
root
.
- Database Host:
localhost
- Database Name:
- Click Submit.
Step 4a: If WordPress cannot create wp-config.php automatically
In most cases, WordPress will generate the wp-config.php file for you after submitting the database info. However, if file permissions prevent this, you’ll see a message providing a block of code.
To proceed:
- In your project’s root folder, locate
wp-config-sample.php
. - Duplicate it and rename it
wp-config.php
. - Paste the provided code block from the WordPress setup screen into this file.
- Save and close the file.
- Reload your browser to continue with the WordPress installation process.

Quick tip
root
as the default username and root as the password. Make sure to adjust accordingly if needed.Step 5: You’re ready to build
Once installed, you can log in to your local WordPress dashboard and start creating your theme in the /wp-content/themes/
directory.
Modern local dev tools: LocalWP and DevKinsta
While XAMPP and MAMP give you a full behind-the-scenes look at how WordPress works, they’re not always the most efficient for day-to-day theme development. That’s where tools like LocalWP and DevKinsta come in. These modern local development tools do much of the behind-the-scenes work for you.
These tools help set up a fully working WordPress site in minutes, without configuring Apache, ports, PHP versions, or databases. Professional developers and agencies widely use them because they make the setup process painless, while still giving you the flexibility to dive into the code.
LocalWP: All the WordPress, none of the server setup
If you’re creating a theme and don’t want to get bogged down in server setup, LocalWP is your go-to. It’s designed for freelancers, designers, and developers who need a reliable, quick-start WordPress environment.
Key benefits:
- One-click site creation.
- Automatic SSL for local sites.
- Easily switch PHP versions.
- Works seamlessly with popular hosts like WP Engine and Flywheel.
- Intuitive GUI with no command line needed.
How to set up with LocalWP:
- Download LocalWP from localwp.com.
- Install and launch the app.
- Click “+ New Site”, name your project.
- Choose Preferred Environment (it pre-configures PHP, MySQL, NGINX/Apache).
- Click Add Site. LocalWP will handle WordPress installation automatically.
- Access your site via a friendly URL like
https://mycooltheme.local
.
Now you’re ready to start building your theme inside /app/public/wp-content/themes/
.
Why pros use it: LocalWP removes tedious setup steps so that you can focus on development. For freelancers or small agencies, it’s often the fastest path from idea to working prototype.
DevKinsta: For devs who want more control
If you’re working with clients hosted on Kinsta or you want a bit more flexibility in managing environments, DevKinsta is a solid choice. It’s built on Docker, but you won’t need to touch Docker commands. The GUI takes care of that.
Key benefits:
- One-click WordPress site creation with Docker-based isolation.
- Built-in email testing with MailHog.
- PHP version switching.
- Push/pull sites to Kinsta hosting (if you’re a Kinsta customer).
- More robust for developers who want local environments closer to production setups.
How to set up with DevKinsta:
- Download DevKinsta from kinsta.com/devkinsta.
- Install Docker (required for DevKinsta to run).
- Launch DevKinsta and click “New Site”.
- Follow the prompts to create a WordPress install.
- Open your new local site in a browser and start development.
Why pros use it: DevKinsta is a great option for teams working on larger projects where the development environment must match the real-world environment. It’s a step up in complexity but offers more control for projects that need it.
Choosing your local development tool
For most WordPress theme developers, LocalWP and DevKinsta are the fastest and simplest ways to get started.
- LocalWP is ideal if you want an easy, one-click setup without worrying about technical details.
- DevKinsta offers similar simplicity but is better suited for developers working with Kinsta hosting or who prefer a Docker-based environment (without needing to manage Docker manually).
- XAMPP or MAMP for learning core server setup and WordPress internals.
What about all those other tools I hear about?
Advanced developers working on larger, multisite, or CI/CD-driven projects often use tools like DDEV or Lando (both Docker-based) or Valet (for macOS users who prefer minimal CLI setups). These offer more flexibility but come with a steeper learning curve.
For theme development workflows, LocalWP and DevKinsta will cover most needs, while more complex tools are better suited for large-scale projects or specialized development teams.
2. How to create a WordPress theme
To create a WordPress theme, you’ll need a basic understanding of several core concepts, including the template hierarchy, file structure, and how to add functionality and styling. This comprehensive guide will walk you through the steps on how to create a WordPress theme, from setting up essential files to implementing advanced features and styling strategies.
Setting up your theme files and folder
With your local WordPress environment up and running, it’s time to build the foundation of your theme. WordPress expects default files and folders to be in place for a theme to function correctly.
If you’re using LocalWP, DevKinsta, XAMPP, or MAMP, the steps here are exactly the same. This part of theme development doesn’t change, no matter which tool you used to set up WordPress.
Step 1: Locate the themes directory
Navigate to your WordPress installation directory, then find:
/wp-content/themes/
This is where all WordPress themes live. You’ll see folders for default themes like twentytwentyfour
.
Step 2: Create your theme folder
Inside /themes/, create a new folder for your theme. Name it something relevant to your project:
/wp-content/themes/mytheme/
Keep it lowercase, no spaces. This folder will house all your theme files.
Step 3: Add the essential theme files
At a minimum, WordPress needs two files to recognize a theme:
- style.css — This file not only styles your theme but also includes important metadata.
- index.php — The main template file that controls what’s displayed on the front end.
Example style.css
Header:
This file must contain the theme’s metadata.
/* Theme Name: My WordPress Theme Theme URI: https://example.com/mytheme Author: Your Name Author URI: https://example.com Description: A new WordPress theme built from scratch. Version: 1.0 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: mytheme */
Even if you don’t add any styles yet, this file is necessary for WordPress to recognize your theme.
Basic index.php
template:
<?php get_header(); ?>
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile; endif; ?>
</div>
<?php get_footer(); ?>
This is a simple loop that tells WordPress to display posts.
Step 4: Add functions.php
for Theme Functionality
Next, create a functions.php file in your theme folder. This is where you’ll add functions to load stylesheets, register menus, and more.
Start with this basic setup to enqueue your stylesheet:
<?php
function mytheme_enqueue_styles() {
wp_enqueue_style('main-style', get_stylesheet_uri());
}
add_action('wp_enqueue_scripts', 'mytheme_enqueue_styles');
?>
Step 5: Activate your theme
Now that you have the three core files (style.css
, index.php
, functions.php
), your theme is ready to activate.
- Log in to your local WordPress admin dashboard.
- Go to Appearance > Themes.
- You’ll see your new theme listed. Click Activate.
Visit your local site in a browser. You won’t see much yet since the theme’s still mostly blank, but this is where the fun begins.

Quick tip
index.php
and style.css
helps you understand how WordPress assembles pages. As you build, you’ll learn how template hierarchy and modular file structure make theme development scalable and organized.3. Expanding your theme: templates and hierarchy
From here, you’ll start expanding your theme by adding template files like header.php
, footer.php
, single.php
, and archive.php
. This is where WordPress’s Template Hierarchy comes into play.
WordPress uses a collection of primary, secondary, and variable templates to generate pages. Some templates, like header.php
and footer.php
, are used everywhere. Some are only used in specific conditions. The Template Hierarchy is the set of rules that decides which file gets loaded for different types of content.
As you build your theme, you’ll want to create additional template files to control how posts, pages, archives, and other content types are displayed. You’ll also begin styling it with CSS and enhancing functionality through WordPress hooks and functions.
Common template files you’ll need
Here are the key template files that most themes include:
Template File | What it Does |
---|---|
header.php |
Contains the site’s <head> section and opening HTML structure. Included at the top of every page. |
footer.php |
Holds the closing tags and footer content. Included at the bottom of every page. |
single.php |
Displays individual blog posts. |
page.php |
Handles static pages like “About” or “Contact”. |
archive.php |
Lists multiple posts, such as category pages or blog posts. |
404.php |
Displays when a page isn’t found. |
Step 1: Create header.php
and footer.php
Let’s modularize your site’s structure to avoid repeating HTML in every file.
Example header.php:
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<header>
<h1><?php bloginfo('name'); ?></h1>
<h2><?php bloginfo('description'); ?></h2>
</header>
Example footer.php
:
<footer>
<p>© <?php echo date('Y'); ?> <?php bloginfo('name'); ?></p>
</footer>
<?php wp_footer(); ?>
</body>
</html>
Step 2: Update index.php
to use header & footer includes
Now you can simplify index.php
:
<?php get_header(); ?>
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile; endif; ?>
</div>
<?php get_footer(); ?>
Step 3: Add post-specific templates
As your theme grows, WordPress will check if specialized templates exist for certain content types. If they do, it’ll use them according to the template hierarchy.
Create:
single.php
— to control the layout for individual blog posts.page.php
— for static pages.
These files will look similar to index.php
but can have unique structures or styles for their respective content.
Step 4: Understand the template hierarchy flow
Here’s a simplified version of how WordPress decides which template to load:
- For a single post, it first looks for
single-{post-type}.php
, thensingle.php
, thenindex.php
. - For a page, it checks
page-{
slug}.php, thenpage.php
, thenindex.php
. - For an archive page, it looks for
category.php
,tag.php
,author.php
, orarchive.php
. - If no file matches, it defaults to
index.php
.

Quick tip
Step 5: Create a 404 template
Don’t forget the 404.php
file to handle “Page Not Found” errors:
<?php get_header(); ?>
<h1>Oops! That page can't be found.</h1>
<p>It looks like nothing was found at this location.</p>
<?php get_footer(); ?>
4. Adding functions and features to your theme (functions.php
)
Now that your theme’s structure is taking shape with templates, it’s time to add functions and features to your theme, like menus, widget areas, and dynamic content. This is where functions.php becomes the heart of your theme’s dynamic features.
Think of functions.php
as your theme’s personal plugin file. It’s where you can:
- Enqueue styles and scripts.
- Register navigation menus and widget areas.
- Add theme support for things like featured images.
- Hook into WordPress’s core functionality to customize behavior.
Step 1: Enqueue stylesheets and scripts
Instead of hardcoding CSS or JS files directly into header.php, WordPress expects you to enqueue them properly. This ensures compatibility with plugins and prevents conflicts.
Here’s a basic example to load your theme’s main stylesheet:
<?php
function mytheme_enqueue_styles() {
wp_enqueue_style('main-style', get_stylesheet_uri());
}
add_action('wp_enqueue_scripts', 'mytheme_enqueue_styles');
?>
If you want to add a JavaScript file:
function mytheme_enqueue_scripts() {
wp_enqueue_script('custom-js', get_template_directory_uri() . '/js/custom.js', array('jquery'), '1.0', true);
}
add_action('wp_enqueue_scripts', 'mytheme_enqueue_scripts');
Step 2: Register navigation menus
To make menus manageable via the WordPress admin dashboard:
function mytheme_register_menus() {
register_nav_menus(array(
'header-menu' => __('Header Menu', 'mytheme'),
'footer-menu' => __('Footer Menu', 'mytheme')
));
}
add_action('init', 'mytheme_register_menus');
In your theme files (like header.php), display a menu like this:
<?php
wp_nav_menu(array(
'theme_location' => 'header-menu'
));
?>
Step 3: Add widget areas (sidebars, footers, etc.)
Widgets give you flexible content blocks via WordPress’s dashboard. You can create widget areas in the sidebar like this:
function mytheme_widgets_init() {
register_sidebar(array(
'name' => __('Sidebar', 'mytheme'),
'id' => 'sidebar-1',
'description' => __('Widgets in this area will appear in the sidebar.', 'mytheme'),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
));
}
add_action('widgets_init', 'mytheme_widgets_init');
Then, in your template file (like sidebar.php
), output the widget area:
<?php if (is_active_sidebar('sidebar-1')) : ?>
<aside id="sidebar">
<?php dynamic_sidebar('sidebar-1'); ?>
</aside>
<?php endif; ?>
Step 4: Add theme support features
WordPress allows you to declare theme support for various features, making your theme more robust and integrated with WordPress core functionality.
For example, to enable featured images (post thumbnails):
add_theme_support('post-thumbnails');
Enable custom logo support:
add_theme_support('custom-logo');
Step 5: Add custom functions & hooks (optional)
As your theme grows, you can hook into WordPress actions and filters to customize behavior. For example, modifying the excerpt length:
function mytheme_custom_excerpt_length($length) {
return 20; // Set excerpt length to 20 words
}
add_filter('excerpt_length', 'mytheme_custom_excerpt_length');

Quick tip
functions.php
clean and modular. If you’re adding a lot of custom functions, consider splitting them into separate files and including them with require_once()
to maintain organization.5. Styling your theme: modern CSS for best results
With your theme’s structure and functionality ready, it’s time to bring it to life visually. Styling is where you define how your website will actually look, like colors, fonts, layouts, and responsive behavior.
While you can start with basic CSS, modern best practices like CSS Grid, Flexbox, and CSS Variables will help you build cleaner, more maintainable, and responsive themes.
Step 1: Structure your CSS
You’ve already created a style.css file. Here’s a good structure to follow:
/* Reset & Base Styles */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; background-color: #fff; } /* Layout & Containers */ .container { max-width: 1200px; margin: 0 auto; padding: 20px; } /* Header */ header { background: #f5f5f5; padding: 20px; } /* Footer */ footer { background: #222; color: #fff; text-align: center; padding: 10px; }
Step 2: Build responsive layouts with Flexbox and CSS grid
Responsive design ensures your theme looks great on desktops, tablets, and mobile devices.
Flexbox example:
.navbar { display: flex; justify-content: space-between; align-items: center; }
CSS grid example:
.grid-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
Use Flexbox for navigation bars, simple alignments, and one-dimensional layouts. Use CSS Grid for more complex, two-dimensional layouts like galleries or content sections.
Step 3: Use CSS variables for consistency
CSS Variables help you define design tokens like colors and font sizes in one place, making global changes easy.
Example:
:root { --primary-color: #3498db; --secondary-color: #2ecc71; --font-heading: 'Roboto', sans-serif; } body { color: var(--primary-color); font-family: var(--font-heading); }
If you need to tweak your primary color later, you’ll only have to change it in one place. This is super handy for larger themes or when working with client branding.
Step 4: Media queries for mobile-friendly themes
Ensure your theme adjusts for smaller screens using media queries:
@media (max-width: 768px) { .container { padding: 10px; } .navbar { flex-direction: column; align-items: flex-start; } }
Start with “mobile-first” design principles, progressively enhancing for larger screens.
Can I create a WordPress theme with no coding?
If you’re concerned your coding skills aren’t up to creating a custom WordPress theme, AI builders can help bridge the gap. Websites generated with the AI Website Builder rely on WordPress templates. That means you can create a WordPress theme in a visual, no-code editor. These tools aren’t just for non-techies. They can significantly speed up the website-building process, including theme development.
A hybrid approach to custom theming using the 10Web AI Website Builder
- Generate a new site, or migrate your existing site to 10Web.
- Create header and footer templates.
- Create default WordPress page templates. (Index.php, Single.php, 404 page, etc.)
- Define styles and create reusable content parts.
Now you’re ready to export templates or the entire site to use and reuse as needed, where you need it. Sound intriguing? Try this post for a deeper understanding of no-code custom WordPress themes.

Build Your WordPress Website Today
Seen something you like? With 10Web's AI Builder, you can create a professional WordPress website in minutes. No coding skills required.
6. Tools and best practices for testing and debugging
You’ve built your theme’s structure, added functionality, and styled it to look beautiful. But before you declare victory, you need to ensure everything works flawlessly across browsers, devices, and user scenarios. Testing and debugging aren’t glamorous, but they’re what separates a polished, professional theme from a half-baked one.
Let’s walk through how to methodically test and debug your theme like a pro.
Step 1: Manual testing across devices and browsers
Start by loading your site in the major browsers:
- Chrome
- Firefox
- Safari
- Edge
Test across devices:
- Desktop
- Tablet
- Smartphone
What you’re looking for:
- Layout consistency (no weird overlaps or broken grids)
- Navigation functionality (menus, links)
- Readability (font sizes, colors)
- Responsiveness (does it adjust smoothly on different screen sizes?)
Step 2: Use your browser’s Developer Tools
Every modern browser comes with Developer Tools (DevTools). These allow you to:
- Inspect HTML & CSS.
- Simulate various device viewports (Mobile, Tablet, Desktop).
- Debug JavaScript.
- Monitor network requests and page performance.
Pro Tip:In Chrome DevTools, press Ctrl+Shift+M (Windows/Linux) or Cmd+Shift+M (Mac) to toggle responsive design mode and simulate different devices.
Step 3: Cross-browser testing services
Manual testing can be limited by the devices and browsers you have. Services like BrowserStack and CrossBrowserTesting allow you to test your theme on real devices and browsers in the cloud..
Step 4: Import theme unit test data
WordPress provides Theme Unit Test Data, a demo content XML file that populates your site with posts, pages, images, menus, and more. It’s designed to stress-test your theme’s layouts and styling in various content scenarios.
How to import:
- Download the XML file from WordPress Theme Unit Test.
- Go to Tools > Import in your WordPress dashboard.
- Choose WordPress and upload the XML file.
- Review how your theme handles various content types, post formats, and edge cases.
Real-world content will never be as “perfect” as your sample posts. This test data helps you spot layout inconsistencies, image size issues, and quirky alignment bugs early on.
Step 5: Debugging tools & plugins
Here are some must-use tools for catching hidden problems:
WP_DEBUG modeEnable debugging in your wp-config.php file:
define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false);
Errors will be logged to wp-content/debug.log.
Query monitor pluginA developer’s Swiss Army knife. It helps you track:
- Database queries
- PHP errors & notices
- Enqueued scripts and styles
- HTTP API calls
Theme check pluginThis plugin scans your theme against WordPress.org coding standards and best practices. A must-do if you plan to distribute or submit your theme.
Browser DevTools consoleCheck for JavaScript errors or warnings in the browser console that could affect interactivity.
7. Optimizing theme performance & accessibility
A theme isn’t truly “finished” until it’s optimized for speed, accessibility, and overall user experience. Search engines (and your visitors) expect fast-loading, easy-to-navigate websites that are usable by everyone, including people with disabilities.
Luckily, there are a ton of tools available to audit and optimize your theme’s performance and accessibility.
Step 1: Run a Google Lighthouse audit
Google Lighthouse is a free tool built into Chrome DevTools that gives you a report card on:
- Performance (load speed, rendering)
- Accessibility
- Best Practices
- SEO
How to run Lighthouse:
- Open your site in Chrome.
- Open DevTools (Ctrl+Shift+I / Cmd+Option+I).
- Go to the Lighthouse tab.
- Choose categories to audit (Performance, Accessibility, SEO, etc.).
- Click Generate Report.
Focus on:
- Largest Contentful Paint (LCP): Measures how quickly main content loads.
- Cumulative Layout Shift (CLS): Tracks visual stability (no janky jumps as content loads).
- Interaction to Next Paint (INP): Measures how responsive your site feels to user input.
Step 2: Optimize assets (CSS, JS, images)
Performance is often a matter of reducing bloat. Here are quick wins:
- Minify CSS & JS: Use tools like Autoptimize or WP Rocket to compress code.
- Defer or async load non-essential JS.
- Optimize images: Use modern formats (WebP/AVIF) and compress images. Tools like 10Web Image Optimizer or TinyPNG can automate this.
- Use lazy loading for images and videos to defer off-screen content loading.
Step 3: Accessibility best practices
Accessibility isn’t just a “nice to have.” It’s a necessity for a professional theme. Here’s what to prioritize:
Accessibility Checklist for WordPress themes:
- Use Semantic HTML Tags (header, nav, main, section, article).
- Ensure Color Contrast Ratios meet WCAG AA standards.
- Enable Full Keyboard Navigation for menus, buttons, and forms.
- Include Descriptive Alt Text for all meaningful images.
- Ensure Focus States are Visible on interactive elements.
- Use ARIA Roles Sparingly and Correctly where HTML alone isn’t sufficient.
- Test with a Screen Reader (NVDA, VoiceOver) to verify navigability.
- Run Automated a11y Tests (axe DevTools, WAVE).

Quick tip
Step 4: Accessibility testing tools
Use automated tools to catch common a11y issues:
- axe DevTools (Chrome extension)
- WAVE Web Accessibility Evaluation Tool
- Google Lighthouse (Accessibility section)

Quick tip
Step 5: Ensure Core Web Vitals compliance
Google’s Core Web Vitals (CWV) are critical for SEO rankings. Here’s how to target them:
- LCP (Largest Contentful Paint): Optimize image sizes, use efficient CSS.
- CLS (Cumulative Layout Shift): Reserve space for images, avoid late-loading ads or embeds.
- INP (Interaction to Next Paint): Reduce JavaScript execution time, prioritize main-thread work.
You can monitor CWV in real-time using:
- PageSpeed Insights (Google)
- Chrome User Experience Report (CrUX)
- Lighthouse in DevTools
8. Preparing your theme for distribution
You’ve built and refined your WordPress theme. It’s functional, beautiful, and optimized. Now it’s time to package it for use beyond your local environment. Whether you’re creating a personal project, delivering a theme to a client, or planning to submit it to the official WordPress Theme Directory, proper preparation is key.
Step 1: Clean up your code
Before distributing your theme, ensure it’s clean and production-ready:
- Remove unnecessary comments, debug code, and console logs.
- Ensure consistent formatting (indentation, spacing) across files.
- Double-check that all custom functions follow WordPress coding standards.
- Delete any unused files, assets, or placeholder content.

Quick tip
Use PHP_CodeSniffer with WordPress Coding Standards to automatically scan for formatting and syntax issues.
Step 2: Include Essential Files & Documentation
Your theme folder should contain:
- Template files (
index.php
,single.php
, etc.) - Stylesheets and scripts
- Images (like
screenshot.png
) functions.php
style.css
with proper theme metadata header- A
README.md
or readme.txt explaining:- Theme description
- Installation instructions
- List of features and requirements
- Changelog (if applicable)
Step 3: Create a theme screenshot
WordPress uses a screenshot to display your theme in the dashboard under Appearance > Themes.
- Size: 1200 x 900 pixels
- File name:
screenshot.png
- Use a clean, uncluttered preview that showcases the theme’s design highlights.
Step 4: Test your theme for distribution
Run final tests to ensure compatibility and adherence to WordPress standards:
- Theme Check Plugin: This will scan your theme against official theme review guidelines.
- Manual QA: Test across browsers and devices one last time.
- Ensure compatibility with the latest WordPress version.
Step 5: Zip your theme folder
Package your theme into a .zip
file. This is the format WordPress expects for theme installation.
- Select your theme folder.
- Right-click and choose Compress/Zip.
- Ensure the
.zip
file contains only the theme folder and its contents (no parent folders).
Step 6: Submitting your theme to the WordPress theme directory (optional)
If you plan to share your theme publicly:
- Review the WordPress Theme Review Guidelines.
- Sign up or log in to your WordPress.org account.
- Navigate to the Theme Upload Page.
- Submit your
.zip
file. - Be prepared for a review process, which may require revisions based on feedback from the Theme Review Team.
The approval process can take several weeks. Be proactive by adhering strictly to coding, security, and documentation guidelines to speed up approval.
Alternative: Distribute directly to clients or sell your theme
If your theme is for client work or a marketplace (like ThemeForest):
- Ensure licensing and copyright details are clearly defined.
- Consider including a “Getting Started Guide” PDF for non-technical users.
- Check marketplace submission requirements, as they may differ from WordPress.org’s guidelines.
What’s next?
Congratulations! You’ve taken your theme from scratch to a distributable, professional-grade product. Whether you’re using it for personal projects, client work, or contributing to the broader WordPress community, you now have a solid foundation in theme development.
From here, you can explore advanced topics like:
- Creating block-based (FSE) themes
- Developing child themes
- Integrating Gutenberg block patterns
- Automating theme deployment with Git & CI/CD pipelines
Build themes with confidence (and know when to work smarter)
By now, you’ve learned how to create a WordPress theme from the ground up. Structuring essential files, building out templates, adding dynamic functionality, styling with modern CSS, and fine-tuning for performance and accessibility. You’ve also seen how to prepare your theme for distribution, whether it’s for a personal project, a client, or the wider WordPress community.
This hands-on, code-first approach gives you full control over your theme’s design and functionality. It’s a rewarding process, but as you’ve seen, it requires time, patience, and attention to detail.
If you’re working on a project that demands rapid turnaround or you simply want to experiment with layouts and design ideas without starting from scratch every time, using an AI-powered workflow can streamline the process. For those moments, check out our guide on how to create a custom WordPress theme with AI. It’s a hybrid approach that blends AI efficiency with your creative control.
Seen something you like? With 10Web's AI Builder, you can create a professional WordPress website in minutes. No coding skills required.
Build Your WordPress Website Today
FAQ
Do I need to know PHP to create a WordPress theme? What files are required for a WordPress theme to work? To unlock more features, you’ll typically add functions.php, header.php, footer.php, and other templates. Can I build a WordPress theme without using Full Site Editing? How do I upload a custom theme to WordPress? Make sure your theme has all required files and is tested before uploading. How do I test my WordPress theme before publishing it? Testing across devices and screen sizes is key before deploying. What's the difference between a WordPress theme and a template? Can I sell or submit my theme to the WordPress Theme Directory?
Yes, but only the basics. WordPress themes rely on PHP to pull content from the database and display it dynamically. You don’t need to be an expert, but understanding loops, functions, and how template files work will make the process much smoother.
At a minimum, every WordPress theme needs two files:
Yes. You can still create classic themes using PHP templates and the WordPress Template Hierarchy. Full Site Editing (FSE) with block themes is the newer approach, but classic theming remains fully supported and widely used, especially for custom-coded themes.
If you’ve built a theme locally and want to use it on a live site:
You can test it in your local environment using tools like:
Yes. If your theme follows WordPress coding standards, you can submit it to the official Theme Directory. Alternatively, you can sell it on third-party marketplaces (like ThemeForest) or directly to clients. Just make sure you include proper documentation and licensing.
Automate manual work with 10Web Managed WordPress Hosting and 10Web AI Website Builder. Optimize your WordPress website effortlessly.
Simplify WordPress with 10Web