I have two custom page templates ("template-blog-left.php" with the sidebar of the left side, and "template-blog-right.php" with the sidebar on the right side.) but I don't know if there's any way of creating a custom single post template for each of them, so that If I select the "template-blog-left.php" for my "Blog" page, then the single page should have the sidebar on the left.

So, in other words, is it possible to have a custom single page being selected automatically every time I make a post, based on the custom page template that is selected for the "Blog" page.

  • you said you have "template-blog-left.php template which have sidebar in left, so automatically if you will assign this template to any post it will have a sidebar in left . Commented Aug 28, 2013 at 10:07

1 Answer 1


Yes it is possible using get_template_part();

Assuming that you use a standard single.php:

 * Template name: template-blog-left

get_header(); ?>

<div id="left-sidebar">
  <!-- Here your left sidebar -->

<div id="content">
        //This function will look for single.php file in your theme folder
        get_template_part( 'single' );

<?php get_footer(); ?>
  • @DanielSarmas, you're welcome
    – iEmanuele
    Commented Aug 28, 2013 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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