Tag: wordpress



21 八 09

前言:其实2.8早出来了,一直在我的后台闪来闪去的,实在看不过去,还是升了吧。本身就自带自动升级,但是我的就是升不上去啊,老是报错,怎么办呢,只好手动来进行了,以下就是手动升级的相关步骤。

环境:Wordpress 2.7 升级到 2.8.4
系统:CentOS 5.3

升级步骤:
1、备份
最好还是准备下,不然把自己的心血写的东西都丢了可不值啊
备份两个东西:数据库 可以找个备份插件 也可以自己手动导出SQL语句 或者直接备份数据库文件
wordpress程序文件 : 其实这个中间有几个注意要保存的 A、原来的配置文件(有数据库连接方面的信息) B、有空间整体保存还是最保险的 C、最要注意 相册文件(自己定义的目录) 还有上传的相关文件(默认在wp-content/uploads下) D、最有用的文件 插件和主题 在wp-content下面

2、下载
从官方下载 latest.zip 我这里下载的 中文版的 http://cn.wordpress.org/wordpress-2.8.4-zh_CN.zip

3、解压并安排目录方法

解压到原来的同级目录  使用软件连接方法来安排目录
例:目录blog 为对外的目录 那么 原来的 wordpres-2.7 和wordpress-2.8.4都在同一目录

删除原来wordpress-2.7与blog的软连接
建议新连接 ln -s wordpress-2.8.4 blog  这样就很快切到新的了

4、拷贝原来的文件

拷贝2.7 目录下 wp-config.php 和 .htaccess(如果有做) 到新的目录下
拷贝原来的模板文件: \cp -r ../wordpress-2.7/wp-content/themes/*   wp-content/themes/  (记得加*号 不然会copy目录的 如果要强制覆盖请用\cp)
拷贝原来的插件文件:  \cp -r ../wordpress-2.7/wp-content/plugins/*   wp-content/plugins/   (如果你不怕麻烦 怕出错的话 只要copy你需要的插件就可以了 也可以配置完后再添加插件,有些插件可能会有版本的需求,而导致出错)
拷贝原来的上传文件:     cp -r ../wordpress-2.7/wp-content/uploads    wp-content/            (新安装有是没有这个目录的)
恢复相册文件:如果之前的目录已经定好了 想下载更新时还要这么麻烦 同样可以把相册目录移动blog 目录之外 利用软件连接来进行访问  这样可以避免备份的数据过大。

5、配置

在浏览器上运行 /wp-admin/upgrade.php 升级数据库
删除或者重命名 wp-admin 目录下的 install.php 和 upgrade.php

Ctr-F5 刷新自己的网站即可看到系统已经升级成功。

6、升级过程中遇到的问题(如自动升级):

1、问题:使用自动升级失败。

下载失败。:Operation timed out after 30 seconds with 1524600 bytes received

解决:修改 wp-admin/includes/file.php

把 444行的 $response = wp_remote_get($url, array(’timeout’ => 30));

30改成300 或 600

2、问题:PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature  进行解压安装时报的错

未解决

7、升级后的完善工作

添加新插件  修改模版
之后还对服务器软件进行了相关的升级

我的BLOG 升级后相关数据:

Wordpress 2.8.4

Nginx 2.8.8

PHP 5.2.10

Mysql 5.1.36







18 二 09

给自己的BLOG加上了代码的语法高亮这插件,对比了好几个类似的插件,觉得这个还是不错的,并且还加上了CSS显示更好看些了,现在转载记录下,以备切换之用。另外注意的事不要设置line为1 即为显示行号,因为我的首页的摘要会出现问题。

下载地址:http://wordpress.org/extend/plugins/wp-syntax/

安装

  1. Upload wp-syntax.zip to your Wordpress plugins directory, usually wp-content/plugins/ and unzip the file. It will create a wp-content/plugins/wp-syntax/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. Create a post/page that contains a code snippet following the proper usage syntax.

写文章时,用 <pre> 和 </pre> 将代码包住即可。同时在<pre> 中指定参数 lang=”代码类型” ling=”起始行数”。
最后在使用的过程中注意 lang=”” 一定要使用双引号,而不能用单引号。

Usage(使用方法)

Wrap code blocks with <pre lang=”LANGUAGE” line=”1″> and </pre> where LANGUAGE is a GeSHi supported language syntax. See below for a full list of supported languages. The line attribute is optional.

Example 1: PHP, no line numbers

function foo()
{     echo "Hello World!n";   }
for ($i = 0; $i &lt; 10 $i++) {     foo();   }
?&gt;

Example 2: Java, with line numbers

1
2
3
 public class Hello {
   public static void main(String[] args)
{     System.out.println("Hello World!");   } }

Example 3: Ruby, with line numbers starting at 18

18
19
20
21
22
 class Example
   def example(arg1)
     return "Hello: " + arg1.to_s
   end
 end

Supported Languages(支持的语言)

The following languages are supported in the lang attribute:

abap, actionscript, ada, apache, applescript, asm, asp, autoit, bash, blitzbasic, bnf, c, c_mac, caddcl, cadlisp, cfdg, cfm, cpp-qt, cpp, csharp, css, d, delphi, diff, div, dos, dot, eiffel, fortran, freebasic, genero, gml, groovy, haskell, html4strict, idl, ini, inno, io, java, java5, javascript, latex, lisp, lua, m68k, matlab, mirc, mpasm, mysql, nsis, objc, ocaml-brief, ocaml, oobas, oracle8, pascal, per, perl, php-brief, php, plsql, python, qbasic, rails, reg, robots, ruby, sas, scheme, sdlbasic, smalltalk, smarty, sql, tcl, text, thinbasic, tsql, vb, vbnet, vhdl, visualfoxpro, winbatch, xml, xpp, z80

(Bold languages just highlight the more popular ones.)

Styling Guidelines

WP-Syntax uses default GeSHi colors by default. It also uses inline styling to make sure that code highlights still work in RSS feeds. To spruce up your code snippets to look more like the screenshots, try adding this CSS to your stylesheet template:
WP-Syntax 能够保留代码中的缩进(空格),让代码更加美观。不过,WP-Syntax高亮的代码默认不会进行拆行,如果代码过长的话,将会导致页面被撑大,影响美观。将如下 CSS 样式写入到所选择的主题样式中,能够解决这个问题:

.wp_syntax {
  color: #100;
  background-color: #f9f9f9;
  border: 1px solid silver;
  margin: 0 0 1.5em 0;
  overflow: auto;
}

/* IE FIX */
.wp_syntax {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: expression(this.scrollWidth &gt; this.offsetWidth ? 15 : 0);
}

.wp_syntax table {
  table-layout:fixed;
  overflow:hidden;
  text-overflow:ellipsis;
  WORD-BREAK: break-all;
  WORD-WRAP: break-word;
  border-collapse: collapse;
}

.wp_syntax div, .wp_syntax td {
  vertical-align: top;
  padding: 2px 4px;
}

.wp_syntax .line_numbers {
  text-align: right;
  background-color: #def;
  width:30px;
  color: gray;
  overflow: visible;
  font-family: 'Lucida Grande',
  'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif;
}

/* potential overrides for other styles */
.wp_syntax pre {
  margin: 0;
  width: fixed;
  float: none;
  clear: none;
  WORD-BREAK: break-all;
  WORD-WRAP: break-word;
  overflow: visible;
  font-size:8pt;
  font-family: Courier New;
}

Advanced Customization

WP-Syntax supports a wp_syntax_init_geshi action hook to customize GeSHi initialization settings. Blog owners can handle the hook in a hand-made plugin or somewhere else like this:

 add_action('wp_syntax_init_geshi', 'my_custom_geshi_styles');
  function my_custom_geshi_styles(&amp;$geshi)
{
     $geshi-&gt;set_brackets_style('color: #000;');
     $geshi-&gt;set_keyword_group_style(1, 'color: #22f;');
 }
?&gt;

This allows for a great possibility of different customizations. Be sure to review the GeSHi Documentation.







15 一 09

Author: Betty

Main features of the plugin:

  1. It supports multibyte language (such as Chinese). It will not produce gibberish as some other excerpt plugins do.
  2. The html tags in the original posts, i.e., the font styles, colors, hyperlinks, pictures and such are preserved in the excerpt.
  3. For better readability, it displays 300 characters for each post on the homepage and 150 characters for each post on archive pages.

Installation

  1. Unzip and upload the wp-utf8-excerpt directory to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. In your theme directory, edit the index.php file by changing
    <?php the_content(); ?>
    

to

    <?php
        if (is_single() or is_page()) {
            the_content();
        } else {
            the_excerpt();
        }
    ?>

http://wordpress.org/extend/plugins/wp-utf8-excerpt/







14 一 09

Installation

* Download sitemap-generator.zip and uncompress
* Upload the entire sitemap-generator folder (not just the files inside) to your plugins directory
* Activate the plugin in your administration panel
* Configure the plugin in the options panel (under DDSitemapGen)
* If using permalinks, read the permalink section below
* Simply add the following line to a WordPress page (where you would like the sitemap to display):

<!– ddsitemapgen –>

<自己用的是wordpress 2.7 方法是添加一个页面,在源码中添加上面这句就可以了,其它的WEB配置里面去配置>

Note: For those of you using the new rich-text editor – be sure to click the ‘html’ button to edit the page source directly. Otherwise Wordpress will wrap code tags around the line which generates the sitemap and it will not work properly.