我正在尝试学习如何构建自己的 WordPress 主题。我已经完成了一些教程,但我遇到了障碍。我似乎无法弄清楚我做错了什么。当我将页脚的 html 放在与“home.php”相同的文件中时,它可以正常工作。但是,当我尝试将其分开并将页脚 html 放在“footer.php”中并使用“get_footer();”时 功能,页脚根本没有出现,可见或在代码中......它不存在。我想知道是否还有其他事情我忽略了让页脚工作?如果不是,那么当我将代码拆分为不同的主题部分/文件时,可能导致页脚不显示的原因是什么?
这是 home.php 的代码:
<?php
/*
Template Name: Front Page
*/
?>
<?php get_header(); ?>
<?php get_template_part('nav'); ?>
<div id="content"><!-- Start Content -->
<?php get_sidebar('left'); ?>
<div id="middle-column" class="grid_8"><!-- Main Content Begins Here -->
<?php if (have_posts()) : while (have_posts()) : the_post(); ?><!-- Start Loop -->
<div class="post">
<h2 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2>
<div class="entrytext">
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
</div>
</div>
<?php
endwhile;
else:
?>
<?php _e('This page does not appear to have been set up yet. Sorry, please try again later. Thanks!'); ?>
<?php endif; ?>
<!-- End Loop -->
</div>
<?php get_sidebar('right'); ?>
<?php get_footer(); ?>
这是footer.php的代码:
<div style="clear:both;"></div>
<div id="push"></div>
</div><!-- End Content -->
</div><!-- End Container -->
</div><!-- End Wrapper -->
<div id="footer"><!-- Start Footer -->
<div id="footWrap"><!-- Start #footWrap -->
<p>© Brent Blackwood</p>
</div><!-- End #footWrap -->
</div><!-- End Footer -->
<div id="headerBand"></div><!-- Placed here for SEO purposes -->
<div id="navBand"></div><!-- Placed here for SEO purposes -->
</body>
</html>