I have created a custom post type called "Projects".

My permalinks settings is postname and I'd like to keep it that way.

I created a page template named projects.php (Template Name: Projects) and added the script to list the projects in this page.

I added a page with the template selected as Projects.

However, when I'm viewing this page in the frontend, it calls the default archive page instead of the Projects page template.

How do I fix this?

The default archive page has its own format for displaying stuff, for example, the page title displays like Catagory: Projects.

I want a separate page template for the projects page and keep the archive page for the categories and tags. Just like for the blogs there's a blog page and then a separate archive page, I want something similar for the custom post type as well instead of calling an archive page for everything!

  • Did you try naming your template archive-projects.php as per the codex? codex.wordpress.org/Post_Type_Templates
    – Ismail
    Commented May 23, 2016 at 1:27
  • Did you set has_archive when you registered your post type? WordPress automatically generates an archive if you want it, you don't need to create a page with a custom template and query.
    – Milo
    Commented May 23, 2016 at 1:43
  • @Samuel I didn't create a separate archive page for it. I just want that the custom post list should be called in the custom page template I created. Commented May 23, 2016 at 2:41
  • @Milo Yes I did set it to true Commented May 23, 2016 at 2:42
  • if you don't want to use it, you can set it to false and the conflict with your page will be gone. However, it's easier to deal with pagination and such if you just use the archive instead.
    – Milo
    Commented May 23, 2016 at 3:48

1 Answer 1


Custom page templates are for pages - not post type archives :)

Naming your template file as archive-projects.php will cause Wordpress to select it for your Projects archive page.

You also don't need the /* Template Name: Projects */ in there, as this template naming is default Wordpress behaviour. See the visual overview of the template hierarchy to understand how you can name your template files so Wordpress will select them.

Alternatively, if you are wanting to replace the default Wordpress custom post type archive with your own page, just ensure your page has the same slug as the custom post type - in this case, that would be projects. You can change the slug of the page at the top of the post editor, just under the title.

  • Hi, thanks for the suggestion. I will definitely try it. But, if we don't have /* Template Name: Projects */, then how can we create a dynamic page for it from the WP backend UI? Commented May 23, 2016 at 1:31
  • If you want to use the template as a page template as well, then yes, you can include Template Name in there. However, usually you would create a separate template for your post type archive and for a page you wish to set a custom template for.
    – Tim Malone
    Commented May 23, 2016 at 1:32
  • @TESTacy I just edited my answer to add another para at the end, which I think now might be what you're after.
    – Tim Malone
    Commented May 23, 2016 at 1:34
  • So this will work only with the archive page? Wont a page template do the job instead? Commented May 23, 2016 at 2:49
  • Yes you can use a page template instead - but Wordpress will already do the querying work for you if you use an archive template :) Using a page template will probably only really be useful if you want to add custom content from the page itself as well.
    – Tim Malone
    Commented May 23, 2016 at 2:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.