WordPress:Upgrade 1.2 to 1.5

来自站长百科
跳转至: 导航、​ 搜索

WordPress v1.5 has been available since April. If you are upgrading from a previous version, these simple steps will help you upgrade to the newer version in no time.

从四月开始,就可以使用WordPress1.5版本。如果你从前一个版本升级到1.5版本,下面简单的步骤,会帮助你立刻升级。

Reasons for Upgrading[ ]

升级的理由[ ]

There are many reasons for upgrading any software. Generally, they are the fact that the software has been improved and security issues have been addressed. Here are some specific reasons for WordPress users:

升级任何软件都有许多理由。一般来说,这些理由正是软件得到升级,安全问题得到解决的原因。下面是WordPress用户升级WordPress版本的一些基本原因:

Improved Features
The WordPress interface and functions have not only been improved, they've been expanded. There is a list of new WordPress:WordPress Features, and in summary, the program is faster, cleaner, easier to use, and more powerful.

;提升功能:WordPress界面和功能并没有提升,但是确扩展了。这里总结了新的WordPress功能的列表,这样WordPress软件会更强大,更容易使用,速度更快,版面更整齐。

Template Driven Design
WordPress uses templates to generate the pages dynamically. You can control the presentation of content by editing the templates using the Template Editor tool and the Template Tags.

;模板驱动设计:WordPress使用模板自动地创建网页。你可以使用模板编辑器和模板标签,通过编辑模板,控制内容的显示情况。

Quick Design and Layout Changes
There are hundreds of WordPress Themes to choose from and changing the look of your site is easier and faster than ever before.

;快速地更改设计和布局:你可以选择成百上千的WordPress 主题,而且更改你的站点的外观,会变得更快,更简单。

Comment Spam Filters and Protection
Comment spam filtering comes built in, catching most of the comment spammers before you see their posts in your comments.

;垃圾评论过滤器与评论保护:垃圾评论过滤功能是内置的,能够抓取大多数垃圾评论发送器,这样这些垃圾评论不会出现在你的评论中。

Extensive Plugins
There are hundreds of new and improved WordPress:Plugins which will easily extend the functionality and power of your website. Creating plugins is easier than ever, too.

;插件扩展:有成千上万的新的,改良后的插件,能够轻易地更改你的网站的功能。创建插件也比以往更加简单。

Before You Start[ ]

准备[ ]

Before proceeding, backup your database, WordPress files, and your entire site.
开始升级之前,请备份你的数据库,WordPress文件,和整个站点。
  1. Begin by backing up your entire site and WordPress files and your database.
  1. 首先备份整个站点和WordPress文件和你的数据库
  1. Store your backups off-site, like on your hard drive.
  1. 离线储存你的备份,如储存在你的硬盘中。
  1. Disable all active plugins. In the Administration > Plugins panel, click Deactivate on each plugin. You can re-enable them after you're done upgrading.
  1. 取消所有插件的运行。在管理>插件面板,点击每个插件上的取消。升级之后,你可以重新激活插件。

Begin the Upgrade[ ]

开始升级[ ]

  1. Download the new version of WordPress to your hard drive and unzip it to a new folder. (nb: version 1.5 can be found here in the archive).
  1. 将新版本的WordPress下载到你的硬盘中,然后将这个软件解压到一个新的文件夹。((nb:可以在这里归档中找到1.5版本)。
  1. Delete the old WordPress files from your web host, except wp-config.php.
  1. 从你的网络主机上删除旧的WordPress文件,wp-config.php除外。
  1. Upload the new WordPress files.
  1. 上传新的WordPress文件。
  1. Replace your old index.php with the new index.php icluded in the download. (You can turn your old index into a theme following instructions below, so don't delete it entirely.) **Remember to adjust the path for wp-blog-header.php if your index page lives in a different directory than your wordpress installation.
  1. 用新下载的WordPress中的index.php取代旧的软件中的index.php。(你可以遵循下面的指示,将旧的索引转变为主题,但是不要删除整个索引。)**如果你的索引页的目录与你安装WordPress的目录不同,请记住调整wp-blog-header.php的路径。
  1. From your browser, type http://example.com/wp-admin/upgrade.php, using the file path to your WordPress wp-admin directory, to bring your database up to date.
  2. 在浏览器中输入http://example.com/wp-admin/upgrade.php,使用文件路径到达你的WordPress wp-admin目录,将数据库升级到最新状态。
  1. Immediately login to wp-admin. Select "options" then "Permalinks" from the menu. Click the "Update Permalink Structure" button, you shouldn't have to do anything else.
  1. 立马登录到wp-admin。选择"选项",然后从菜单中选择"Permalinks"。点击"更新Permalink 结构"按钮,你就不用执行其它的步骤了。

You should have a new WordPress 1.5 installation with the default template applied to your website. Don't worry, you can change this in a minute. First, reward yourself with a cold soda and some candy. If you want to adapt your old template to our new space-age system, continue on...

你应该安装新的WordPress 1.5版本,并且将默认模板应用到你的网站上。不要担心,你几分钟就能够实现更改。首先,给自己准备一些冰苏打水和一些糖果。如果你想要将旧的版本应用到我们新的space-age系统上,请继续…

Check The New WordPress[ ]

核查新的 WordPress[ ]

Before you begin to fiddle with your new WordPress upgrade, take few minutes to test drive it. There have been some changes. For a simple test drive, the article WordPress:First Steps With WordPress points out many of the new changes to the WordPress:Administration Panels and the way your site works.

处理升级后的WordPress版本之前,花几分钟测试这个版本。这个版本已经发生了一些变化。简单地测试一下,文章WordPress开始运行指出了管理面板以及你的站点运行的新变化。

thumb|right|WordPress Presentation PanelBegin by poking around the WordPress:Administration Panels. You are now greeted with a Dashboard which lists your latest activity and news from around the WordPress Community. Keep exploring and you will find Write Page and Manage Page panels that handle the new WordPress WordPress:Pages, allowing you to add content that is outside of WordPress:The Loop like "Contact", "Sign up", "About", and "Resume".

thumb|right|WordPress Presentation 面板开始,请浏览管理面板。你会看到Dashboard,列出了你最新的活动和WordPress 团队的最新新闻。继续查看,你会发现处理新的WordPress页面编写页面管理页面 面板,能够使你添加The Loop以外的内容,如"联系", "Sign up", "关于",和"履历"。

On the Presentation panel, you will now see a list of Themes. There should be two. Click View Site and you will see the new look of your site. Click the back button and then select the other Theme. Click View Site again and you will see that the look of your site has completely changed.

Presentation面板上,你会看到主题列表。应该有两个主题。点击浏览站点,你将会看到你的站点的新外观。点击返回按钮,然后选择其它的主题。再次点击访问站点,你将会看到你的站点的外观已经完全改变了。

thumb|left|Default Theme Single Post ViewChange it back to the Default Theme, then click View Site and take a wander around your new site. Click the various links and see how the look and information changes the way it is displayed. With the Default Theme, there are two main looks. One for the non-single post pages like the front page, categories, archives, and searches, and other one for the single-post pages. The sidebar is gone. The new modular Themes allow you to customize the look of a variety of pages within your site.

thumb|left|默认主题单篇文章浏览将其更改为默认主题,然后点击浏览站点,浏览你的新站点。点击不同的链接,看看外观和信息的显示方式的更改情况。使用默认主题,出现两种主要的站点外观。一种是网页上有几篇文章,如首页,类别,归档,和搜索,另一种是网页上只有一篇文章的外观。没有边栏。新的模块主题能够使你自定义站点内的不同页面的外观。

When you are ready to really change the look of your site, or convert it to match your previous look, proceed on.

当你真的准备更改你的站点的外观,或者想切换你先前站点的外观,请继续。

New Template System[ ]

新的模板系统[ ]

A few things have changed in the way templates work in 1.5, most notably the addition of themes which make developing your site templates infinitely easier.

模板在1.5版本中的运行方式有所改变,最显著地就是1.5版本,添加了主题,能够非常简单地开发你的站点模板

The first thing you will notice is the template files don't live in the root directory any more, they're in wp-content/themes so go there now.

你首先发现的是,模板文件不在根目录里了,而是在wp-content/themes中,因此现在你需要进入wp-content/themes。 You should see at least two folders there, default and classic. Each folder now holds a complete WordPress Theme. Classic is the old WordPress style converted into a theme. Default is an adaptation of Kubrick. Poking around these themes, especially "classic" if you were familiar with our old template, will be the best way to learn how themes work.

你在那里至少能够看到两个文件夹。默认经典。每个文件夹都有个完整的WordPress主题。经典主题是旧的WordPress样式转变成的主题。默认是适应了Kubrick。浏览这些主题,如果你熟悉旧的模板,特别要看看"经典的"主题,这样可以更有效地学习,这些主题的运行方式。

Upgrading Old Templates - Easy[ ]

升级旧的模板 – 简单[ ]

To turn your old template into a theme : 将你的旧的模板转变为主题:

  1. Create a directory for your Theme in wp-content/themes such as wp-content/themes/mytheme/, all lowercase and one word.
    1. wp-content/themes 中为你的主题创建一个目录,如wp-content/themes/mytheme/,是一个单词,而且都是小写字母。
    2. Put your old index.php in the theme directory you just created
    3. 将旧的index.php放入你刚刚创建的主题目录中。
    4. Using a text editor, open it up to edit
    5. 使用文本编辑器,打开文本编辑器,开始编辑
    6. Delete the wp-blog-header.php line at the top that says not to delete :)
    7. 删除顶上方显示不要删除的wp-blog-header.php 行 :)
    8. Delete the wp-blog-header.php line at the top that says not to delete :)
    9. 删除顶上方显示不要删除的wp-blog-header.php 行 :)
    10. Replace the following line: (or a similar CSS link)
       %%% <?php echo get_settings('siteurl'); ?>/wp-layout.css %%%
      With this:
       %%% <?php bloginfo('stylesheet_url'); ?> %%%
    11. Replace this:
       %%% <?php include(ABSPATH . 'wp-comments.php'); ?> %%%
      With this:
       %%% <?php comments_template(); ?> %%%
    12. 将下面的行: (或者相似的 CSS 链接)
       %%% <?php echo get_settings('siteurl'); ?>/wp-layout.css %%%
      替换为:
       %%% <?php bloginfo('stylesheet_url'); ?> %%%
    13. <li将这个:
       %%% <?php include(ABSPATH . 'wp-comments.php'); ?> %%%
      替换为:
       %%% <?php comments_template(); ?> %%%
    14. Copy your old stylesheet to your theme directory and name it style.css
    15. 将旧的样式表复制到你的主题目录中并且命名为style.css
    16. Open style.css and add the following header (copy and paste this and then customize it):
    17. 打开 style.css 并且添加下面的标头(复制,粘贴,然后自定义这个标头):
        /*
          Theme Name: My Hawt Blog
          Theme URI: http://example.com/
          Description: Best theme EVAR
          Version: 1.0
          Author: Me
          Author URI: http://example.com/
        */
      


    18.   /*
          主题名: 我的 Hawt 博客
          主题 URI: http://example.com/
          描述: 最好的主题 EVAR
          版本: 1.0
          作者: Me
          作者 URI: http://example.com/
        */
      


    19. Go to the Presentation tab of the admin interface
    20. If you see your Theme on the list, activate it. If you don't review these instructions to make sure you did them all right.
  2. 进入管理界面的 Presentation 标签
  3. 如果你在列表上看到了你的主题,激活这个主题。如果你没有阅读这些指示说明,请立马阅读。


Upgrading Old Templates - Advanced[ ]

升级旧的模板 – 高级的[ ]

Depending upon how customized your old WordPress site was, the process of modifying your old WordPress layout and design may be simple or complex. There are basically three methods: Working from your old site files, designing from scratch or redesigning an existing WordPress Theme.

根据你的旧的WordPress站点的自定义程度的差别,更改旧的WordPress的布局和设计可能很简单,也可能很复杂。基本上有三种更改的方法:从处理旧的站点文件开始或者从零开始,重新设计当前的WordPress主题。

We recommend the latter if you are not very experienced with CSS and HTML/XHTML. To design your Theme from scratch, you will find more indepth information on how to modify the layout elements in Themes and customize your Theme at WordPress:Theme Development. If you are determined to use your old site files, here are the instructions.

如果你不很熟悉CSS和HTML/XHTML,我们建议你从使用后一种方法。从零开始,设计主题,你会发现许多关于怎样更改主题布局元素和在主题发展中自定义主题的深入信息。如果你决定使用旧的站点的文件,下面有一些指示说明:

To modify an existing Theme, follow these step-by-step instructions.

要更改当前的主题,请遵循一步步的指导。

  1. Copy the following files from the Classic or Default WordPress Theme into a new folder:
    1. 从经典的或者默认的WordPress主题中,将下面的文件复制到一个新的文件夹:
      1. index.php
      2. wp-comments.php
      3. wp-comments-popup.php
      4. wp-layout.css
      5. searchform.php
      1. index.php
      2. wp-comments.php
      3. wp-comments-popup.php
      4. wp-layout.css
      5. searchform.php
    2. Open your index.php in your text editor.
    3. 在你的index.php 文本编辑器中打开index.php
    4. Comment out the wp-blog-header require line at the top of index.php. Do this by putting // at the start of each line.
    5. index.php的顶上方comment out wp-blog-header需要的行。在每行的开始加上//。
      <?php 
      //* Don't remove this line. */
      //require('./wp-blog-header.php');
      ?>
      
    6. Update the stylesheet import line in index.php. Replace this:
      @import url( <?php echo get_settings('siteurl'); ?>/wp-layout.css );

      with this:

      @import url( <?php bloginfo('stylesheet_url'); ?> );
      
    7. If you use the Default Theme, you will have a line like this:
      <link rel="stylesheet" href="<?php echo get_settings('siteurl'); ?>/wp-layout.css" type="text/css" media="screen" />

      You must change that to this:

      <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    8. Update the wp-comments include line in index.php. Replace this:
      <?php include(ABSPATH . 'wp-comments.php'); ?>
      

      with this:

      <?php comments_template(); ?>
      
    9. Now save index.php
    10. Rename wp-comments.php to comments.php
    11. Open wp-comments-popup.php. Find this line at the top :
      require ('wp-blog-header.php');

      You must comment out that line like this:
      // require ('wp-blog-header.php');

      The top of your wp-comments-popup.php must look like this:

      <?php 
      /* Don't remove these lines. */
      $blog = 1;
      //require ('wp-blog-header.php');
      add_filter('comment_text', 'popuplinks');
    12. Save the file.
    13. Rename wp-comments-popup.php as comments-popup.php.
    14. Add a theme header to wp-layout.css that looks something like this (you can just copy and paste this for now):
      /*
      Theme Name: My Original Layout
      Theme URI: http://myblog.com/
      Description: Your theme
      Version: 1
      Author: You
      Author URI: http://myblog.com/
      */
    15. Now rename wp-layout.css to style.css.
    16. You should now have 4 or 5 files:
      1. index.php
      2. comments.php
      3. comments-popup.php
      4. style.css
      5. IF you use the Default Theme, you will have 5 files - searchform.php
    17. Now create a folder with the name of the theme (for example, carrots) and put the first four files there into that folder (and searchform.php if you use the Default Theme).
    18. FTP this carrots folder into the wp-content/themes/ folder. You should already have a classic folder and a default folder inside there.
    19. Set the active theme to this theme you have created by selecting it in the Presentation Panel.














    <?php 
    //*不要移除这一行。 */
    //需要('./wp-blog-header.php');
    ?>
    
  2. 更新样式表index.php中的导入行。将这个:
    @import url( <?php echo get_settings('siteurl'); ?>/wp-layout.css );

    替换为:

    @import url( <?php bloginfo('stylesheet_url'); ?> );
    
  3. 如果你使用默认主题,你会有一行:
    <link rel="stylesheet" href="<?php echo get_settings('siteurl'); ?>/wp-layout.css" type="text/css" media="screen" />

    你必须将这一行,更改为:

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
  4. 在index.php中更新wp-comments的包括行。将这个::
    <?php include(ABSPATH . 'wp-comments.php'); ?>
    

    替换为:

    <?php comments_template(); ?>
    
  5. 现在保存 index.php
  6. wp-comments.php 重新命名为comments.php
  7. 打开 wp-comments-popup.php。在顶上方找到这一行:
    需要 ('wp-blog-header.php');

    你必须 comment out那一行:
    // require ('wp-blog-header.php');

    wp-comments-popup.php的顶上方,看起来必须像 :

    <?php 
    /* 不要移除这些行。*/
    $blog = 1;
    //require ('wp-blog-header.php');
    add_filter('comment_text', 'popuplinks');
  8. 保存文件。
  9. wp-comments-popup.php 重新命名为comments-popup.php
  10. Add a theme header to 给wp-layout.css添加主题标头 (你现在就要复制粘贴这个标头):
    /*
    主题名: 我的最初布局
    主题 URI: http://myblog.com/
    描述: 你的主题
    版本: 1
    作者: 你
    作者URI: http://myblog.com/
    */
  11. 现在将wp-layout.css 重新命名为 style.css.
  12. 你现在应该有4或者5个文件:
    1. index.php
    2. comments.php
    3. comments-popup.php
    4. style.css
    5. 如果你使用默认主题,你就有5个文件- searchform.php
  13. 现在创建一个文件夹,文件夹名为主题名(例如, carrots)并且将那里的前四行添加到文件夹中(如果你使用默认主题,也添加searchform.php)。
  14. 将这个 carrots 文件夹FTP到wp-content/themes/ 文件夹。你在这里应该已经有了个classic 文件夹和default文件夹。
  15. 在Presentation面板中,选择当前运行的主题,并且将主题设置到你已经创建的主题中。



Resources[ ]

资源[ ]