WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Free Plugin by Simon Wheatley v1.5

Custom Post Template

Provides a drop-down to select different templates for posts from the post edit screen. The templates replace single.php for the specified post.

Custom Post Template

The facts

Rating
4.8★ from 43
Active installs
10k+
Price
Free
Last updated
28 Nov 2017
Added
Nov 2008
Requires WP
3.4
Tested up to
WP 3.4.2
Downloads
248,487

Our analysis

AI-assisted

Custom Post Template is a WordPress plugin that allows you to select different templates for individual posts from the post edit screen. It works by replacing the standard single.php template with a custom one defined in your theme, using a specific PHP comment format to identify the template. This plugin is particularly useful for developers who want to manage post templates easily without altering the core theme files.

The plugin does not change templates for posts displayed in archive pages, focusing solely on single post views. It requires custom post template files to be stored in the same directory as the index.php file of your theme.

Best for: This plugin suits developers looking to customise post templates in their WordPress themes.

What it does well

  • Allows selection of custom templates for single posts
  • Easy integration for developers with the cpt_post_types filter
  • Free to use from the WordPress.org directory

Where it falls short

  • Does not affect templates for posts in listing pages
  • Requires specific PHP comment format in template files
  • Limited to WordPress version 3.4.2 and earlier

Verdict

Custom Post Template provides a straightforward way to manage post templates, though its limitations may restrict some users. It is a useful tool for those familiar with theme development.

From the developer

Simon Wheatley's own description of Custom Post Template, lightly tidied.

Provides a drop-down to select different templates for posts from the post edit screen. The templates are defined similarly to page templates, and will replace single.php for the specified post. This plugin will NOT switch the templates for the different posts in a listing page, e.g. a date or category archive, it will only affect the template used for single posts (i.e. you can choose a template which is not single.php).

Post templates, as far as this plugin is concerned, are configured similarly to page templates in that they have a particular style of PHP comment at the top of them. Each post template must contain the following, or similar, at the top:

<?php
/*
Template Name Posts: Snarfer
*/
?>

First note: Page templates use “Template Name:“, whereas post templates use “Template Name Posts:“.

Second note: You must have the custom post template files in your theme in the same directory/folder as your index.php template file, not in a sub-directory/sub-folder.

Developers

If you want to implement the custom post templates on a custom post type, you can use the cpt_post_types filter, here’s an example below of adding the custom post template selector and metabox to the “Movie” and “Actor” custom post types. This code can be added to a plugin or to the functions.php file in your theme.

/**
 * Hooks the WP cpt_post_types filter 
 *
 * @param array $post_types An array of post type names that the templates be used by
 * @return array The array of post type names that the templates be used by
 **/
function my_cpt_post_types( $post_types ) {
    $post_types[] = 'movie';
    $post_types[] = 'actor';
    return $post_types;
}
add_filter( 'cpt_post_types', 'my_cpt_post_types' );

Read the full description on the official page →

Tagged as

Alternatives

Other plugins for custom content structures.

Ad Inserter

Manage Google AdSense ads, banners, ad rotation, sticky widgets, AMP ads, ads.txt, tracking, header and footer...

Free 300k+ installs 4.9★ (2,428)
Advanced Custom Fields

ACF helps customize WordPress with powerful, professional and intuitive fields. Proudly powering over 2 millio...

Free 2M+ installs 4.5★ (1,438)
Simple Custom Post Order

Easily reorder posts, pages, custom post types, and taxonomies with intuitive drag-and-drop sorting in the Wor...

Free 300k+ installs 4.8★ (569)
WP Activity Log

The #1 user-rated activity log plugin for event logging, activity monitoring and change tracking.

Free 300k+ installs 4.7★ (488)
Custom Post Type UI

Admin UI for creating custom content types like post types and taxonomies

Free 1M+ installs 4.6★ (276)