Create Template for Custom Post Type same like for Page

It sounds like you are talking about this page display template: page-{slug}.php – If the page slug is recent-news, WordPress will look to use page-recent-news.php And you want single-{cpt-slug}-{slug}.php. If so, I believe you can approximate that page template handling with the following: function cpt_slug_template_wpse_117630($template) { global $post; $templ = locate_template(‘single-‘.$post->post_type.’-‘.$post->post_name.’.php’); if ( ‘book’ == … Read more

home.php not loading

You say you copied the entire content of index.php into home.php but I assume you have made some changes? Because if not the pages looks identical so maybe it is loading, but just the same? Now are you having posts or pages you want to display on your front page? Because for the posts and … Read more

Load child template based on parent

Instead of putting something on the template, you can keep templates clean and add to functions.php a function that use ‘template_include’ action hook to check parent page template and return same template for children pages. add_action(‘template_include’, ‘auto_child_template’); function auto_child_template( $template=”” ) { if ( ! is_page() ) { return $template; } else { $page = … Read more

How to add posts list to a page template?

In your wp-content/themes/your-theme folder you need create your own page template… CUSTOM PAGE TEMPLATE In the same folder where you just created your new file, you should see a file named page.php. Open that file by choosing to edit it, and then copy everything you find inside of it. Then, at the very top of … Read more