用bootstrap构建wordpress主题简单概述
时间:2014-03-24 18:02:37
1、什么是bootstrap
Bootstrap是一个响应式的框架,用来创建web网站和应用(http://www.bootcss.com/)。
2、制作主题前应该先去bootstrap官网(http://www.bootcss.com/)自带的一些JS和CSS(好的bootstrap应该有3个文件夹css、js、img)
3、打开你带有WordPress所有文件的目录并导航至wp-content ---- themes,在里面新建一个文件夹,名字随便你自己取,但是最好是你想新建的主题的名字(但是这个名字和你在后台看到的主题名字无关),新建一个index.php文件。然后把你刚才的含有bootstarp组件的文件夹拷贝进去。
4、wordpress主要包含的一些文件有:index.php、header.php、footer.php、page.php、category.php、sidebar.php、single.php、functions.php、style.css,把这些文件都新建好。
5、在网上一张大小为300*225的图片,图片名字固定叫screenshot.png,把这张图片放进刚才新建的文件夹里,这张图片就是你在后台看到主题的图片。
6、在style.css里面加入一些代码:
/*Theme Name: wp
Theme URI: http://teamtreehouse.com/wordpress-bootstrap-theme-tutorial
Description: A demo theme built to accompany the Treehouse blog post How to Build a WordPress Theme with Bootstrap.
Author: Timo
Author URI: http://teamtreehouse.com/
Version: 1.0
Tags: responsive, white, bootstrap
License: Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
License URI: http://creativecommons.org/licenses/by-sa/3.0/
This simple theme was built using the example Bootstrap theme "Basic marketing site" found on the Bootstrap web site http://twitter.github.com/bootstrap/examples/hero.html*/
第一行的wp就是你在后台显示主题的名字。