enter image description here

I had created the custom post type , and added page-attributes to the register_post_type, and created a page ( foo ) and added the page slug to the page template with page-slug.php. The page template is displaying in the page ( foo ) I created but not in the custom post type the above image shows in the custom post type.

When i selected the page template in the page panel the template is not grabbed. But the post i created is displayed in the page(foo) with default content.php template part

  • This is expected behaviour, only pages have page templates by default. page-slug.php will only work with pages, similar to how post-slug.php will only work with posts. Have you consulted the template hierarchy diagrams? – Tom J Nowell Apr 18 '17 at 16:37
  • 1
    Maybe this can help? – birgire Apr 18 '17 at 16:40
  • Take a look into this graph, as @TomJNowell mentioned. – Jack Johansson Apr 18 '17 at 17:35

Your Answer

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

Browse other questions tagged or ask your own question.