简体   繁体   中英

Nested php include files - Not showing content Wordpress

I have some php include files which are pulling through content to my main pages such as header.php

Within these php files I have other php includes which call different elements of the design.

It will displaying perfectly fine until I converted the flat HTML files into a Wordpress theme directory.

The main header.php file displays but any php includes within it do not. Please could someone help.

Here is an example of a php file header-withbooker.php

<?php include 'includes/content/headers/with-booker.php';?>

Within this file it then looks like:

    <?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';?>

Any idea what I am doing wrong?

Thank you in advance

You can include files in WordPress Like:

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

Hope this works for You.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM