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

时间:2018-05-09 09:52:58

标签: 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 &amp; drivers available worldwide</h2>
        </div>
    </div>

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

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

知道我做错了什么吗?

提前谢谢

1 个答案:

答案 0 :(得分: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' );

希望这适合你。