I need to set a custom created template to be used whenever a single blog post is displayed.

I can see how to assign custom templates to pages under Page Attributes > Template, but how do I tell my WP site to use a custom template when displaying a single blog post?


There is no build in template assigment for indivual standar posts from edit screen. But you can assign templates for individual posts. There are several options:

Use WordPress template hierarchy system

Under the root folder of your theme you can create this files:

  • single.php for all single posts of any type.
  • single-post.php, if this file exists, it will be used for standard posts instead of single.php.
  • single-{post-type}.php, if this file exists, it will only for {post-type} posts instead of single.php

Use template_include filter

Using template_include filter you can use any template file for single posts that meet your requeriments. For example, use the template template-for-my-post.php for post with ID 124:

add_filter( 'template_include', 'cyb_post_template');

function cyb_post_template( $template ) {
    if ( is_single( 124 )  ) {
        $new_template = locate_template( array( 'template-for-my-post.php' ) );
        if ( '' != $new_template ) {
            return $new_template ;
    return $template;
  • I tried it @cybmeta and technically it is single-post.php in WP ver 4.1. Not single-posts.php
    – tammy
    Jan 8 '15 at 20:18
  • Sorry for the typo, fixed.
    – cybmeta
    Jan 8 '15 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.