php - 嵌套的 php 包含文件 - 不显示内容 Wordpress
问题描述
我有一些 php 包含文件,它们将内容拉到我的主页,例如 header.php
在这些 php 文件中,我有其他 php 包含调用设计的不同元素。
在我将平面 HTML 文件转换为 Wordpress 主题目录之前,它会显示得非常好。
主 header.php 文件显示,但其中包含的任何 php 文件均不显示。请有人帮忙。
这是一个 php 文件 header-withbooker.php 的示例
<?php include 'includes/content/headers/with-booker.php';?>
在这个文件中,它看起来像:
<?php include 'includes/content/nav/top-nav.php';?>
<div class="container">
<div class="full-header">
<?php include 'includes/content/rating-box.php';?>
<h1>Your journey begins here</h1>
<h2>4-90 seater vehicles & drivers available worldwide</h2>
</div>
</div>
</header>
<!-- Close Header Box -->
<?php include 'includes/content/booking/main-booker.php';?>
知道我做错了什么吗?
先感谢您
解决方案
您可以在 WordPress 中包含文件,例如:
get_template_part( 'includes/content/headers/', 'withbooker' );
get_template_part( 'includes/content/nav/', 'top-nav' );
get_template_part( 'includes/content/booking/', 'main-booker' );
希望这对你有用。
推荐阅读
- python - 使用Dash,创建应用,通过回调函数下载文件到本地,问题:Callback error updates download_xlsx.data
- cmake - 为mysql连接器c ++配置cmake的问题
- javascript - 未捕获的类型错误:当目标位于另一个文件中时,无法将属性“onclick”设置为 null
- python - 在python中创建整数列表
- web3 - 如何获取所有山寨币的智能地址?
- python - 如何调整从 web url 显示的照片图像的大小
- facebook-graph-api - Whatsapp 商业产品目录访问错误的权限
- java - 使用 mockito 模拟私有字段没有显示此类字段异常
- arrays - 使用 .find 返回酋长队赢得超级碗的年份。我四处搜索,我不确定为什么我的代码不起作用
- php - Wordpress 主题 LAN 和 LNG 函数调用在 functions.php 中不起作用