构建一个Bootstrap WordPress主题#4 header & footer

接下来让我们从index.php中拆分出header和footer文件:

  1. 在index.php文件中,将第一行至< / nav>标签的所有代码剪切下来。
  2. 创建一个header.php文件,将刚刚剪切的代码粘贴进来并保存代码。
  3. 在index.php文件的头部加入get_header()方法,代码如下:
  

页面看起来没什么变化。
以同样的方式创建footer文件,从< div class="container">到 < /html>的所有代码剪切并粘贴到footer.php文件中:


© 2018 BootstrapWP

在index.php文件结尾添加get_footer()方法


现在页面应该和之前没有变化。

你可能感兴趣的:(构建一个Bootstrap WordPress主题#4 header & footer)