0

OK. This has probably been asked quite a few times, but here it is again. Everything I find on the web is on how to create a custom template for category, which I don't want, and the rest doesn't work. I want to create a custom template for single post, to have plain and simple selection of templates available. One of the blog posts said

locate the single.php and make a copy and call it something like single-newspost.php

Which I did. And then, I should make a php statement like this one

<?php
/*
Single Post Template:News Post
*/
?>

Which I also did. But it didn't work. My guess is- there must also be something in the functions.php , but my knowledge is very limited.

  • single-newspost.php is the template for the custom post type newspost, which, I guess, you don't have. Edit the existing single.php if you don't use custom post types. Make a backup copy of the template first. – Max Yudin May 17 '17 at 16:45
0

In which part it didn't work? is there any error code ?

dont forget to select your new template in post you want. enter image description here

  • There is simply no template selection. No errors either – sharls May 17 '17 at 16:49
  • What about screen option on post page ? is post attributes checked ? you may switch to default theme to see if it's caused by theme / plugin function or not. – rheeantz May 17 '17 at 16:52
0

Correct header format is:

<?php
/*
 * Template Name: News Post
 * Template Post Type: post
 */
?>

Make sure you place this at the top of the file, WordPress only reads a limited number of characters when checking if a template file has a header.

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.