Template Dropdown not showing up within Wordpress administrator page

后端 未结 22 898
清歌不尽
清歌不尽 2021-02-01 17:49

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 templ

相关标签:
22条回答
  • 2021-02-01 18:29

    sass had deleted the content in my child style.css. The template drop down shows again once I added back the comments. /* Theme Name: Sometheme Child Description: Child theme for Sometheme. Template: sometheme Version: 1.1 Text Domain: sometheme-child */

    0 讨论(0)
  • 2021-02-01 18:30

    There are a lot of great answers on this question, but one obvious solution, which initially escaped me, was to double-check that in Dashboard > Settings > Reading you want to set "Your homepage displays" to "Static Page" and then leave the "Posts Page" unselected.

    While themes and a properly coded theme file play a role in the situation, the reason that the page attributes area on the edit page screen doesn't show the templates drop-down may be because you selected a particular page to be your "Posts Page", and so WordPress is not asking you for a custom template to use because it's already using front-page.php or home.php (See WordPress Template Visual Hierarchy).

    Hope this helps someone like me who had a properly coded template file but didn't realize this setting had been selected.

    0 讨论(0)
  • 2021-02-01 18:31

    Put style.css in your theme directory, instead of the css folder. Or

    <?php
        /*
         Template Name: Front Page
        */
    ?>
    

    There must not space between "Template Name:".

    0 讨论(0)
  • 2021-02-01 18:31

    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.
    */
    
    0 讨论(0)
  • 2021-02-01 18:33

    I was just facing the same issue so, the problem is in spacing between 'Template Name' and that colon.

    /*
      Template Name: template-name
    */
    

    Make sure there is no spacing before the colon.

    0 讨论(0)
  • 2021-02-01 18:33

    I found the root of the problem. It is the style.css file inside the theme root.

    1. It must be in "UNIX encoding".

    2. It must have all comments with "Theme Name", "Version", etc.

    0 讨论(0)
提交回复
热议问题