是否可以将外部PHP文件包含到自定义模板中?
我正在尝试将博客添加到我的网站。我的站点中已经有页眉、页脚和侧栏布局。我可以在自定义模板中使用它们吗?
<?php
/*
Template Name: Blog
*/
?>
<?php include( PATH . \'http://www.example.com/includes/header.php\' ); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>">
<?php the_title(); ?>
</a></h2>
<?php include (TEMPLATEPATH . \'/inc/meta.php\' ); ?>
<div class="entry">
<?php the_content(); ?>
</div>
<div class="postmetadata">
<?php the_tags(\'Tags: \', \', \', \'<br />\'); ?>
Posted in
<?php the_category(\', \') ?>
|
<?php comments_popup_link(\'No Comments »\', \'1 Comment »\', \'% Comments »\'); ?>
</div>
</div>
<?php endwhile; ?>
<div class="mypagination">
<?php include (TEMPLATEPATH . \'/inc/nav.php\' ); ?>
</div>
<?php else : ?>
<h2>Not Found</h2>
<?php endif; ?>
<?php include( PATH . \'http://www.example.com/includes/sidebar.php\' ); ?>
<?php include( PATH . \'http://www.example.com/includes/footer.php\' ); ?>
我还尝试了:<?php include(\'http://mywebsite.com/includes/header.php\'); ?>