I have a custom post type called funerals and a page the lists all the posts part of that custom post type. To display a single page I create a file called single-funerals.php and that all works well. But, now I need to have another single post page that only displays a video for a funeral. How would I set that up and link to it from the main page that lists all the posts?
3 Answers
As I answered here, since WordPress 4.7 Post-Type-Templates are enabled in the WordPress core.
That means that you can create multiple templates for the single post-type view. You create these templates like you would create a normal page template. But you need to add a little more code to these templates:
/*
Template Name: Funerals Video Template
Template Post Type: post, funerals
*/
So you will need to copy your single-funerals.php
file, rename it, add some code like the above to the top of the file.
After this, you should see a template select box on the post and funerals edit-screen. (because I specified these 2 post-types with Template Post Type: post, funerals
)
Read more about post-type-templates here.