How can I get WordPress to recognize my newly created page template?
I recently created a new template page, I put the obligatory
<?php
/*
Template Name: New Page Template for testing
*/
?>
as the first part of the code.
Then I uploaded it to the /www/wp-content/themes/neoclassical (where all of the other custom page templates are located).
I now try to c开发者_如何转开发hange the Template of any page to the new theme, and the new page template does not show!
Any ideas on what I need to do to get this to show up as an option on the "Add Page" area?
I have tried changing the theme to another one and back to the original theme, all to no avail.
Thanks everyone.
For future visitors:
I just had this problem in WordPress 4.8. Turns out I had removed the index.php
file from my theme, which was causing the theme not to show the template dropdown.
To fix this just create an empty index.php
file in your theme folder.
(WordPress does try to warn you this file is missing on the Themes page in the admin panel — but you might not visit that page while trying to fix this bug.)
Update: Trace has mentioned in the comment below that a missing style.css
can also cause this to happen.
if the code of the custom template is not good. it wont show.
try using one of the examples here. http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates
So, it turns out that the original developer had put the backup copy of the site in the "LiveFiles" directory, and had pointed the site to "Stuff". I was just uploading to the wrong area.
you just write this sentence and go to admin panal and add new page than you see Template box and find your template page name.
In case this suddenly happens in a working theme, try to delete delete the row starting with _transient_files from wp_options table. That solved the issue for me.
精彩评论