在Wordpress模板中包含PHP文件

As of right now I have this code in one of my templates on my Wordpress theme.

// blah blah

        <div class="content">

            <?php include_once( 'http://www.website.com/new/file.php?variable=1' ); ?>

        </div>

// blah blah

Now, it will load everything in this template except this php include! It will load the sidebar which is included above the /* blah blah */ and it will load the footer, navigation, etc.

When I Inspect Element on Google Chrome it shows this:

<div class="content">

       (it's empty)

</div>

Please help me if you know what I'm doing wrong! Thank you!

include and require don't take URLs. They take server filepaths. Try this:

<?php include_once(ABSPATH.'/new/file.php'); ?>

EDIT: Forgot to mention that query strings cannot be included in filepaths. If a query string is necessary for proper loading, consider loading the page with all necessary query variables in your current URL, loading the part using an iframe, or using file_get_contents()

Iframe:

<iframe src="http://www.website.com/new/file.php?variable=1"></iframe>

file_get_contents()

<?php echo file_get_contents('http://www.website.com/new/file.php?variable=1'); ?>