Title: WordPress not detecting template
Last modified: February 28, 2023

---

# WordPress not detecting template

 *  [antonicofr](https://wordpress.org/support/users/antonicofr/)
 * (@antonicofr)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/wordpress-not-detecting-template/)
 * When I add .html templates in /theme/templates, from the admin pannel it detects
   them properly, however when I add .php templates it does not.
 * I’ve also tried writing the name like this:
 *     ```wp-block-code
       <?php
       /*
       Template Name: Test Page
       */
   
       echo "test page";
       ```
   
 * And Also tried putting it in the root of the theme.
 * It just does not detect them.
 * Help very much appreciated
 * Regards,

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [antonicofr](https://wordpress.org/support/users/antonicofr/)
 * (@antonicofr)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/wordpress-not-detecting-template/#post-16512621)
 * Just saw it detects them but only for Pages, not Posts.
 * Any way to use it for Posts?
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/wordpress-not-detecting-template/#post-16515170)
 * With classic themes, there’s a specific way to get certain templates used for
   certain posts by how they are named. But FSE/block themes use a different paradigm.
   Block themes are still unexplored territory for me, but from looking at Twenty
   twentythree theme’s file structure, the way we should introduce PHP into a template
   is via patterns. The main template in /templates/ refers to a template part in/
   parts/. The template part can then refer to a PHP pattern.
 * Maybe a main template can directly refer to a pattern without an intervening 
   part, IDK? _looks a little further_… yup, we can.
 * How to get a specific template used for certain posts? Again, I know how in classic
   themes, but I’m as lost as you are with block themes. I think the answer lies
   here:
    [https://developer.wordpress.org/themes/advanced-topics/theme-json/#defining-custom-templates](https://developer.wordpress.org/themes/advanced-topics/theme-json/#defining-custom-templates)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WordPress not detecting template’ is closed to new replies.

## Tags

 * [files](https://wordpress.org/support/topic-tag/files/)
 * [html](https://wordpress.org/support/topic-tag/html/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [templates](https://wordpress.org/support/topic-tag/templates/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [3 years, 3 months ago](https://wordpress.org/support/topic/wordpress-not-detecting-template/#post-16515170)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
