【发布时间】:2022-11-26 08:07:03
【问题描述】:
我正在使用 underscore 开发一个 wordpress 主题。
我有一个自定义帖子类型名称project,因此我有,例如,这个 url:http://a.site.local/projects/a-beauty/。
我的template-parts/ 目录中有文件content-projects。
$ cat template-parts/content-projects.php
<h1>Project</h1>
当我浏览http://a.site.local/projects/a-beauty/时,我有我的标题还有侧边栏和页脚(即使它们没有出现在我的content-project.php 和index.php 中)。
这些小部件从哪里来/从哪里加载?
【问题讨论】:
-
我假设模板有
<?php get_header(); ?>, <?php get_footer(); ?> ,<?php get_sidebar(); ?>检查它们的模板(header.php、footer.php 和 sidebar.php)。我不建议删除页面中的功能,只需在该模板(页眉或页脚)中为某些页面或存档类型添加条件语句。参考developer.wordpress.org/reference/functions/get_header和developer.wordpress.org/reference/functions/get_footer。
标签: wordpress templates wordpress-theming