The new template does not appear in the Templates drop-down list.

I created a theme with twenty-four children using the plugin for One-click child tags. Then I copied the page.php template from the parent folder of the theme to the new-template.php file in the child folder. I changed the title in new-template.php to

Template Name: New Template

As far as I know, all I need to do is to make the "New Template" appear in the "Template" drop-down list in the "Page Attributes" section when creating a new page. But the "New Template" is not added to the drop-down list. Does anyone know what the problem is?

Thanks for any help

+5
source share
5 answers

Please make sure to activate your child theme, if your child theme is already activated, try a different template name.

0
source

It's just that there is this error in Wordpress 4.9: https://core.trac.wordpress.org/ticket/42573 , forcing template files to only be scanned once an hour.

To fix it (until they release a new version of WP with this change), download the patch in this big code and make changes from the patch to wp-includes/class-wp-theme.php .

Hope this saves someone the 2 hours I spent on it.

+9
source

For the Wordpress 4.9 bug mentioned above, just upgrade your theme version in style.css, for example. from 1.1.2 to 1.1.3 - even 1.1.2-1. This will force the list of templates to be updated.

+6
source

This worked for me:

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

and a copy of page.php in my dir topic, calling redpage.php

I also had to log out of the administrator and then log in again.

+1
source

I tried everything and finally made it like the stol mentioned above. Update the version of your style.css theme located in the themes folder. The mine was set to 0.1.3. I upgraded to 1.1.2 and it worked.

0
source

Source: https://habr.com/ru/post/1239705/


All Articles