- 构建一个Bootstrap WordPress主题#4 head
- 构建一个Bootstrap WordPress主题#2 构建一个
- 构建一个Bootstrap WordPress主题#9 实现一个
- 构建一个Bootstrap WordPress主题#11 添加搜
- 构建一个Bootstrap WordPress主题#13 开启评
- 构建一个Bootstrap WordPress主题#12 创建文
- 构建一个Bootstrap WordPress主题#1 项目概述
- 构建一个Bootstrap WordPress主题#3 添加侧边
- 构建一个Bootstrap WordPress主题#7 添加内容
- 构建一个Bootstrap WordPress主题#10 设置侧
接下来让我们从index.php中拆分出header和footer文件:
- 在index.php文件中,将第一行至< / nav>标签的所有代码剪切下来。
- 创建一个header.php文件,将刚刚剪切的代码粘贴进来并保存代码。
- 在index.php文件的头部加入get_header()方法,代码如下:
<?php get_header(); ?>
页面看起来没什么变化。
以同样的方式创建footer文件,从< div class="container">到 < /html>的所有代码剪切并粘贴到footer.php文件中:
<div class="container">
<hr>
<footer>
<p>© 2018 BootstrapWP</p>
</footer>
</div>
<script src="http://code.jquery.com/jquery-1.12.0.min.js">
</script>
<script src="<?php bloginfo('template_directory'); ?>/js/bootstrap.js">
</script>
</body>
</html>
在index.php文件结尾添加get_footer()方法
<?php get_footer(); ?>
现在页面应该和之前没有变化。
网友评论