WordPress 模板没有显示在我的页面选项上
我正在开发我的第一个 WordPress 项目。它不会是一个博客,而是一个 CMS,用于快速编辑网站上的内容和页面。
通过在外观 -> 中编辑页眉和页脚,我已经得到了我想要的页眉和页脚。编辑器菜单。在此菜单下,我看到了很多可以使用的模板(屏幕截图 https://i.sstatic.net /P7IyY.png),其中一些我什至认为我不需要或不知道它们来自哪里。但是,当我编辑页面并转到 Page Attributes
部分时,只有 1 个模板的选项(屏幕截图 https://i.sstatic.net/UblzD.png)。如果我选择默认模板
作为页面模板,则似乎仅加载页眉和页脚。
我对 WordPress 还很陌生。我应该在某个地方“激活”这些模板吗?我只打算使用其中的一小部分(索引页面、带有侧边栏的联系页面)。我缺少什么?
谢谢你!
I'm working on my first WordPress project. It won't be a blog but a CMS to quickly edit content and pages on the site.
I've got the header and footer exactly how I want it by editing them in the Appearance -> Editor
menu. Under this menu I see quite a few templates that I could use (screen shot https://i.sstatic.net/P7IyY.png), some of which I don't even think I'll need or know where they came from. However when I edit my pages and go to the Page Attributes
section there is only an option for 1 template (screenshot https://i.sstatic.net/UblzD.png). If I select Default Template
as my template for the page, only the header and footer seem to load.
I am pretty new to WordPress. Am I suppose to 'activate' these templates somewhere? I only plan to use a handful of them (index pages, contact pages with a sidebar). What am I missing?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该查看 WordPress Codex 中发布的有关模板文件等的信息。该图像对于了解 WordPress 引擎何时使用某些文件来呈现页面特别有帮助 WordPress 模板文件图。
您将在此页面找到与该图相关的其余信息。
You should take a look at the information posted in the WordPress Codex on template files and the like. This image is particularly helpful in getting an understanding for when certain files are used by the WordPress engine to render pages WordPress Template Files Diagram.
You'll find the rest of the information relating to that diagram on this page.
我在使用儿童主题时遇到了这个问题。我向子主题添加了一个新的模板文件,但“模板”下拉列表未显示在我的任何页面的页面选项部分上。我检查并仔细检查了模板文件的格式,这不是问题。
事实证明,子主题中的 styles.css 文档格式不正确,并且缺少指定用子主题扩展的父主题的“模板”属性。我更新子主题 CSS 文档以引用父模板,瞧!模板下拉列表按预期显示。
I experienced this issue when using a child theme. I added a new template file to the child theme but the "templates" dropdown did not show on the page options section of any of my pages. I checked and double-checked the formatting of the template file and that was not the issue.
It turns out that my styles.css document in the child theme was not formatted properly and was missing the "template" attribute that designates the parent theme being extended with the child theme. I update the child theme css document to reference the parent template and voila! The template dropdown showed as expected.