---
title: "Developing a custom WordPress theme: 5 tips for success"
url: https://themodernweb.co.uk/2017/02/developing-a-custom-wordpress-theme-5-tips-for-success/
description: "Practical advice for planning, building, and testing a custom WordPress theme without losing sight of maintainability."
published: 2017-02-01
updated: 2017-02-01
---

# Developing a custom WordPress theme: 5 tips for success

Published 2017-02-01

## [February 2017](https://themodernweb.co.uk/2017/02/)

Filed under: [Web Development](https://themodernweb.co.uk/category/web-development/), [WordPress](https://themodernweb.co.uk/category/web-development/wordpress/)

Practical advice for planning, building, and testing a custom WordPress theme without losing sight of maintainability.

## Plan the template hierarchy first

WordPress decides which template file renders a request through a fixed hierarchy. Sketching which of those files a project actually needs, before writing any of them, prevents the common outcome of one enormous template full of conditional branches.

## Build for the person who will edit the content

A theme is used far longer by an editor than by its developer. Field names that describe content rather than layout, and templates that degrade sensibly when a field is left empty, are what separate a theme that survives two years from one that is worked around.

## Use the platform's own patterns

Enqueue stylesheets and scripts properly rather than hard-coding tags, escape output, and use the template tags the platform provides. This is dull advice that pays off the first time the site is updated, moved, or handed to somebody else.

## Keep the stylesheet structured

A theme's CSS grows faster than anything else in the project. Splitting it into partials with a clear order, and keeping component styles next to the components they belong to, keeps it navigable well past the point where a single file stops working.

## Test with real content

Themes look excellent with three tidy demo posts and fall apart with a two-line title, a post with no image, or a category holding a single entry. Testing against the real archive, including its awkward edges, is the fastest route to a theme that holds up.

Next entry: [Essential WordPress plugins for your website](https://themodernweb.co.uk/2017/02/essential-wordpress-plugins/)

Previous entry: [Add animated gradients to your website with Javascript](https://themodernweb.co.uk/2017/02/add-beautiful-animated-gradients-to-your-website/)

Back to [February 2017](https://themodernweb.co.uk/2017/02/) or the [front page](https://themodernweb.co.uk/).
