首页 文章

嵌套的php包含文件 - 不显示内容Wordpress

提问于
浏览
0

我有一些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 &amp; drivers available worldwide</h2>
        </div>
    </div>

</header>
<!-- Close Header Box -->

<?php include 'includes/content/booking/main-booker.php';?>

知道我做错了什么吗?

先感谢您

1 回答

  • 2

    您可以在WordPress中包含文件,如:

    get_template_part( 'includes/content/headers/', 'withbooker' );
    get_template_part( 'includes/content/nav/', 'top-nav' );
    get_template_part( 'includes/content/booking/', 'main-booker' );
    

    希望这适合你 .

相关问题