【问题标题】:Nested php include files - Not showing content Wordpress嵌套的 php 包含文件 - 不显示内容 Wordpress
【发布时间】:2018-05-09 19:27:11
【问题描述】:

我有一些 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';?>

知道我做错了什么吗?

提前谢谢你

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

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

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

    希望这对你有用。

    【讨论】:

    • 这对我来说是这样的:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多