Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New template not showing up in Template dropdown

Tags:

wordpress

I've created a twentyfourteen child theme using the One-click child theme plugin. Then I copied the page.php template from the parent theme folder to the file new-template.php in the child folder. I changed the header in new-template.php to

Template Name: New Template

As far as I know that's all I need to do to get "New Template" to show up in the Template dropdown under Page Attributes when you create a new page. But "New Template" hasn't been added to the dropdown. Does anyone know what the problem might be?

Thank for any help

like image 804
Steve Avatar asked Jan 03 '16 06:01

Steve


2 Answers

Just in Wordpress 4.9 there's this bug: https://core.trac.wordpress.org/ticket/42573 causing the template files to only be rescanned once every hour.

To fix (until they release a new WP version with this changed), download the patch on that bug ticket and make the changes from the patch to wp-includes/class-wp-theme.php.

Hope this saves someone the 2 hours I wasted on this..

like image 66
Jan Żankowski Avatar answered Nov 09 '22 06:11

Jan Żankowski


For the Wordpress 4.9 bug mentioned above, just update the version of your theme in style.css, e.g. from 1.1.2 to 1.1.3 - even 1.1.2-1 will do. This will force updating templates list.

like image 22
stol Avatar answered Nov 09 '22 07:11

stol