WordPress not selecting template in child theme subfolder

I have a WordPress page with the slug contact and a custom template file page-contact.php

The page-contact template file is in a subdirectory of the child theme called page-templates, but it won’t work unless I move it to the root of the child theme. There are other custom themes in the page-templates folder that appear in the WordPress admin so I’m not sure why this template file won’t work there.

Related posts

1 comment

  1. in creating wordpress template based on wordrpess.org you must have
    an opening PHP comment at the top of the file that states the template’s name.
    Example:

    <?php /* Template Name: Example Template */ ?>
    

    Another Sample:

    <?php
    /**
     * Template Name: Full Width Page
     *
     * @package WordPress
     * @subpackage Twenty_Fourteen
     * @since Twenty Fourteen 1.0
     */
    

Comments are closed.