flashweb

从零开始学wordpress 之三

学习地址:http://wenku.baidu.com/view/1a05a118964bcf84b9d57b4d.html

这篇中我们就要着手写wordpress代码了。建议在本地电脑上安装wordpress而不是服务器因为本地相对会容易测试。

1、首先要选择一个本地服务器 例如:XAMPP,不过本人很多次用这个东东,出错的几率的很大,启动不了。所以我安装的是WampServer。

2、创建主题文件。

如果是XAMPP:xampp/htdocs/wordpress/wp-content/themes。

如果是WampServer,可以add an alias,然后指向创建的文件夹。

3、创建index.php和style.css文件。

index.php:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">

    <title><?php bloginfo(\'name\'); ?><?php wp_title(); ?></title>

    <meta http-equiv="Content-Type" content="<?php bloginfo(\'html_type\'); ?>; charset=<?php bloginfo(\'charset\'); ?>" />    
    <meta name="generator" content="WordPress <?php bloginfo(\'version\'); ?>" /> <!-- leave this for stats please -->

    <link rel="stylesheet" href="<?php bloginfo(\'stylesheet_url\'); ?>" type="text/css" media="screen" />
    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo(\'rss2_url\'); ?>" />
    <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo(\'rss_url\'); ?>" />
    <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo(\'atom_url\'); ?>" />
    <link rel="pingback" href="<?php bloginfo(\'pingback_url\'); ?>" />

    <?php wp_get_archives(\'type=monthly&format=link\'); ?>
    <?php //comments_popup_script(); // off by default ?>
    <?php wp_head(); ?>
</head>
<body>

</body>
</html>

style.css:

/*  
Theme Name: Tutorial
Theme URI: http://www.wpdesigner.com
Description: This is my theme for a tutorial.
Version: 1.0
Author: Small Potato
Author URI: http://www.wpdesigner.com/

*/

 

4、安装您的主题。

分类:

技术点:

相关文章: