美文网首页
构建一个Bootstrap WordPress主题#4 head

构建一个Bootstrap WordPress主题#4 head

作者: 埼玉是个逗B | 来源:发表于2018-12-24 14:43 被阅读11次

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

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

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

<div class="container">
    <hr>
    <footer>
        <p>&copy; 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(); ?>

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

相关文章

网友评论

      本文标题:构建一个Bootstrap WordPress主题#4 head

      本文链接:https://www.haomeiwen.com/subject/ppkzkqtx.html