接下来让我们从index.php中拆分出header和footer文件:
- 在index.php文件中,将第一行至< / nav>标签的所有代码剪切下来。
- 创建一个header.php文件,将刚刚剪切的代码粘贴进来并保存代码。
- 在index.php文件的头部加入get_header()方法,代码如下:
页面看起来没什么变化。
以同样的方式创建footer文件,从< div class="container">到 < /html>的所有代码剪切并粘贴到footer.php文件中: