Template Dropdown not showing up within Wordpress

2019-03-12 15:52发布

I am working on a Wordpress-based project, and I just added a new template to the installation by uploading a template file. I was creating a new page that will use my new template, when suddenly, the "Template" dropdown in the "Page Attributes" box is gone.

I am using Wordpress 3.0.1.

Update: I saw a site which told me to revert to the default template, and back to my custom template. Apparently it worked, but I am still baffled on what triggers this bug. Also, any additional knowledge or pointers on this bug would be a great help since my job requires me to patch this (and possibly submit the bug fix to Wordpress). Thanks!

16条回答
啃猪蹄的小仙女
2楼-- · 2019-03-12 16:10

If you have disabled or removed the style.css from the template directory then also it will not work.

So there must be the style.css on template directory then the templates directory will be shown. When you try to remove the style.css from the template directory or using style.css from css folder, then you must be put one style.css on template directory.

Thanks

查看更多
小情绪 Triste *
3楼-- · 2019-03-12 16:11

I had this problem a while back and found one janky solution after a lot of search--sometimes switching to another theme in your install and then switching back to you primary theme will make your templates appear. I know that sounds weird, but worked for me for a while.

查看更多
Fickle 薄情
4楼-- · 2019-03-12 16:13

I managed to fix this by making sure the style.css in the theme root contained the theme comments. I accidentally deleted mine and it removed the templates dropdown.

https://codex.wordpress.org/Theme_Development#Theme_Stylesheet

enter image description here

查看更多
看我几分像从前
5楼-- · 2019-03-12 16:18

I tried many of the suggested answers. None worked in my case.

A possible reason for the Template Dropdown not showing is a missing index.php in your Theme folder.

Just create an empty one, in case your hierarchy does not need one. But the existance of that file enables the option to choose the page template and suppresses an error message in the Choose-Theme page btw

查看更多
爷的心禁止访问
6楼-- · 2019-03-12 16:21

Jack Nicholson was right! You need to make sure your style.css contains the full comment. Example below:

Previously mine was:

/*
Theme Name: Acadata
Theme URI: https://www.factorypattern.co.uk
Description: Custom
Author: Factory Pattern
Version: 1
License: GNU General Public License
License URI: license.txt
*/

Then I changed it to the below and now I can see all my templates.

/*
Theme Name: Acadata
Theme URI: https://factorypattern.co.uk/
Description: Custom
Author: Factory Pattern
Author URI: https://factorypattern.co.uk/
Description: The Acadata theme for WordPress.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: black, brown, orange, tan, white, yellow, light, one-column, two-columns, right-sidebar, flexible-width, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, translation-ready
Text Domain: acadata

This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/
查看更多
闹够了就滚
7楼-- · 2019-03-12 16:22

Please set properly you style.css file specially if you are working on child-theme

/*
Theme Name: Theme Name
Theme URI: http: //mysite.com/
Description: This is a custom child theme for xxx theme
Author: My Name
Author URI: http: //mysite.com/
Template: template_name_in_lowercase
Version: 0.1
*/

查看更多
登录 后发表回答