I want to make a custom contact page with a custom template. But when I create the page i dont get the option to select my Contact-template. What did i do wrong that It wont appear?

Here is the basic structure of my contact-template.php:

Template Name: Contact template 


<p>Contact page</p>

<?php get_footer(); ?>

I did it the same way for my custom home and blog page and those get listed in the options.

  • Where did you place this file in the theme? – bravokeyl Aug 22 '16 at 10:03
  • its in the main folder where the other templates are – mheonyae Aug 22 '16 at 10:09
  • I took the code you give and made a contact-template.php in my test theme. Worked fine. – cjbj Aug 22 '16 at 10:17

Page templates require only a few things to work:

  1. To be in the theme's (or child theme's) directory. Either in the root directory or in a subfolder.
  2. To have appropriate permissions (It will need to be read by WordPress, usually www user). Typically it should have the permission 644 or 640.
  3. To have a Template name header

From the question and comments you have (1) and (3), so the file you have created presumably has the wrong file permissions.

  • I thought only two level deep directory search is done. Can we keep file any where in the theme? – bravokeyl Aug 22 '16 at 10:25
  • @bravokeyl - you're right. Root folder or sub-folder( github.com/WordPress/WordPress/blob/…). My 'anywhere' statement was based on the lack of documentation (I could find) to clarify that, and I only tested root and 1 level down. – Stephen Harris Aug 22 '16 at 10:34

Your Answer

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

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