How can I force custom post type to use a specific template?

I’m creating a newsletter website and each newsletter landing page uses the same template as the front page. Is there anyway to force each newsletter landing page to use the front page template.

Editors can chose the template by template name in the page attributes box when editing a newsletter but I’m wondering if there was a way to make this easier.

Thanks in advance.

2 Answers
2

If your newsletters are a custom post type you can create a template dedicated for it using the template hierarchy.

Template for a single page would be..

single-{custom-post-type-name}.php

Template for an archive page would be..

archive-{custom-post-type-name}.php

These templates get automatically selected you don’t need to add them to a page template attribute in the editor.

Leave a Comment