WordPress GuidePost → Custom Post

How to create a custom post template in WordPress

woman finds best cloud vps providers

Sometimes you want a post to look and feel completely different from your default design. Maybe it’s a product review, a podcast episode, or a photo story—whatever the case, WordPress gives you the tools to create custom templates that change how individual posts are displayed.

You don’t have to build an entirely new theme or hire a developer. Whether you’re comfortable editing code or prefer using plugins, there are flexible ways to build custom post templates that fit your content.

Get fast, reliable hosting for WordPress

Power your site with the industry’s fastest, most optimized WordPress hosting

What is a WordPress post template?

A WordPress post template is a file that controls how a single blog post is displayed on the front end of your site. It’s separate from the content of your post—it determines layout, style, and what elements show up.

Templates are commonly used when:

These templates are especially helpful when the default single.php file doesn’t fit every type of content you publish.

When to use a custom post template

Use a custom post template when you need a layout that differs significantly from your main post template but don’t want to create a full new post type or theme. For example:

It’s ideal for one-off designs or layouts tied to specific categories or tags, and gives you more flexibility without overcomplicating your theme.

Method 1 – Create a reusable, custom, single post template manually

This method involves creating a PHP template file inside your theme folder.

1. Create a new template file in your theme

This code registers the file as a selectable post template. The comment block at the top (Template Name and Template Post Type) is required for WordPress to recognize it.

2. Customize the layout

Now you can build out the structure using:

You’re in full control of what displays and how.

3. Assign the template in the WordPress editor

If you don’t see the Template dropdown, make sure you’re using a block-based theme or that your theme supports post templates for the post type.

Method 2 – Use conditional logic inside single.php

For developers who prefer automation over manual assignment, you can use conditionals in single.php to dynamically load different layouts.

Example:

This tells WordPress to load single-review.php for posts in the “reviews” category. You can base it on tags, post ID, author, or even custom fields.

It’s a good method for bulk rules, but less intuitive for non-dev users.

Method 3 – Create custom templates using a plugin

Not comfortable editing code? There are plugins that let you create and assign custom layouts visually—no PHP required.

Option 1: Block Visibility

Block Visibility plugin helps you show or hide individual blocks based on conditions like user role, post type, category, and more.

Use it to build multiple “versions” of a post layout, all within the same template.

While this isn’t a full template system, it’s ideal for granular control when you don’t want to write code or manage separate files.

Option 2: Custom Layouts – Post + Product Grids Made Easy

Custom Layouts lets you design custom layouts for displaying multiple posts—great for category archives, featured sections, or even replacing your blog page.

You can then insert these layouts using the Custom Layouts block or shortcode anywhere on your site.

This method is especially useful if your goal is to display groups of posts with a custom look—like a portfolio, testimonial wall, or team directory.

Working with block themes and full site editing

If your site uses a block-based theme (like Twenty Twenty-Four), you can build post templates right inside the Site Editor.

Block themes make this process visual, but they’re not as flexible as PHP-based templates for developers. Consider hybrid approaches if you need both power and ease.

Tips for better template design

Troubleshooting custom templates

Ready to get started?

Get the fastest, most secure WordPress.org hosting on the market.

Trust us to help you choose the ideal hosting solution

Loading form…