<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Very Life</title>
	<atom:link href="http://verylifes.com/feed" rel="self" type="application/rss+xml" />
	<link>http://verylifes.com</link>
	<description>Simple happiness</description>
	<lastBuildDate>Sun, 28 Mar 2010 11:13:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to market themselves</title>
		<link>http://verylifes.com/2010/how-to-market-themselves.html</link>
		<comments>http://verylifes.com/2010/how-to-market-themselves.html#comments</comments>
		<pubDate>Sun, 28 Mar 2010 11:13:18 +0000</pubDate>
		<dc:creator>whitewords</dc:creator>
				<category><![CDATA[Gossip]]></category>
		<category><![CDATA[marketing]]></category>
		<category><![CDATA[marketing their own]]></category>

		<guid isPermaLink="false">http://verylifes.com/2010/how-to-market-themselves.html</guid>
		<description><![CDATA[


 To sell themselves as a technology, As long as you have mastered how to market themselves, Then you worry about food, wore. When you learn how to sell yourself, basically anything you can very successfully to market.
Many people want to be like other people, hoping to find a job easily, want to sell him [...]]]></description>
			<content:encoded><![CDATA[<p>To sell themselves as a technology, As long as you have mastered how to market themselves, Then you worry about food, wore. When you learn how to sell yourself, basically anything you can very successfully to market.</p>
<p>Many people want to be like other people, hoping to find a job easily, want to sell him butcher the meat without the fat, in fact, life is a series of marketing.</p>
<p>Sell themselves? First of all should understand that selling the first thing to do first, You need to know to sell things, When we sell themselves, they should fully understand themselves,Each individual must find their own answers,When you think about selling yourself, Need to be honest in their evaluation over the pages.</p>
<p>Sell yourself, you should have enough confidence,Others will be infected with your self-confidence. Believe in your ability,You should understand in different occasions, different people in front to act as different roles.</p>
<p>Appearance. The first contact with people, others through your first appearance, simple to judge you.When your looks bad conditions,It is difficult to continue.In the marketing yourself, never ignore the appearance.People like and the same type of person to do business.</p>
<p>Efforts are right.To sell yourself, let the other side I believe you,Is best able to do, self-awareness, speaking fluent, appropriate friendship,Interaction with different people, applications in different ways.Do not worry too much, to do their utmost to fight for.</p>
<p>When you are selling themselves, and not worry about mistakes, but learn a lesson from the mistakes.Truth and confidence will be your greatest asset.If you want to market themselves, from the start now.</p>
<p><small><strong>Statement:</strong> Site follow the <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Attribution-Noncommercial-Share Alike 3.0 Unported</a> agreement. Reprinted please specify switched </small><a href="http://verylifes.com/2010/how-to-market-themselves.html">Very Life</a></p>
]]></content:encoded>
			<wfw:commentRss>http://verylifes.com/2010/how-to-market-themselves.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sales staff and a beggar</title>
		<link>http://verylifes.com/2010/sales-staff-and-a-beggar.html</link>
		<comments>http://verylifes.com/2010/sales-staff-and-a-beggar.html#comments</comments>
		<pubDate>Sat, 27 Mar 2010 11:02:23 +0000</pubDate>
		<dc:creator>whitewords</dc:creator>
				<category><![CDATA[Gossip]]></category>
		<category><![CDATA[beggars]]></category>
		<category><![CDATA[customer]]></category>
		<category><![CDATA[sales staff]]></category>

		<guid isPermaLink="false">http://verylifes.com/2010/sales-staff-and-a-beggar.html</guid>
		<description><![CDATA[Suddenly thought of this subject.Think, sales staff and the beggars, both of which there are similarities.
Salespersons, exhausted all the skills to promote their own products.Beggars exhausted all skills to market themselves.
Product features, appearance, price is when the salesperson selling points.Beggar&#8217;s appearance, the story and begging to sell when the price of the main points of [...]]]></description>
			<content:encoded><![CDATA[<p>Suddenly thought of this subject.Think, sales staff and the beggars, both of which there are similarities.<br />
Salespersons, exhausted all the skills to promote their own products.Beggars exhausted all skills to market themselves.<br />
Product features, appearance, price is when the salesperson selling points.Beggar&#8217;s appearance, the story and begging to sell when the price of the main points of beggars.<br />
Salesperson is the need for products for customers.Beggars targeted at heart willing to donate a charitable customers.</p>
<p><small><strong>Statement:</strong> Site follow the <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Attribution-Noncommercial-Share Alike 3.0 Unported</a> agreement. Reprinted please specify switched </small><a href="http://verylifes.com/2010/sales-staff-and-a-beggar.html">Very Life</a></p>
]]></content:encoded>
			<wfw:commentRss>http://verylifes.com/2010/sales-staff-and-a-beggar.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>彩色标签云的实现与 Simple Tags,Cool Tags,WP Cumulus 三个标签云插件的比较</title>
		<link>http://verylifes.com/2009/color-tag-cloud-realization-and-simple-tags-cool-tags-wp-cumulus-tag-cloud-plugin-comparison-of-three.html</link>
		<comments>http://verylifes.com/2009/color-tag-cloud-realization-and-simple-tags-cool-tags-wp-cumulus-tag-cloud-plugin-comparison-of-three.html#comments</comments>
		<pubDate>Sun, 08 Nov 2009 03:30:00 +0000</pubDate>
		<dc:creator>whitewords</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Cool Tags]]></category>
		<category><![CDATA[Simple Tags]]></category>
		<category><![CDATA[WP Cumulus]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[原生代码]]></category>
		<category><![CDATA[彩色标签云]]></category>
		<category><![CDATA[插件]]></category>
		<category><![CDATA[标签云]]></category>

		<guid isPermaLink="false">http://verylifes.com/2009/color-tag-cloud-realization-and-simple-tags-cool-tags-wp-cumulus-tag-cloud-plugin-comparison-of-three.html</guid>
		<description><![CDATA[标签云大家都在使用，各种插件也不少，其中比较突出比较有名的两款插件Simple Tags和WP Cumulus几乎是大家的标配了，Simple Tags这个插件可以说功能非常强大，包括热度、内链、样式规范等都非常强，而WP Cumulus则注重在华丽方面，以一种3D的方式来表现标签，更生动化的体现了标签云的函义，而第三款国人开发的插件Cool Tags则是一个非常短小精悍的插件，它功能不多，但更注重在表现方面，比如字体大小样式的规范化和热度色彩的区分。曾经写主题的时候考虑到标签云的样式问题，也曾想自己写一段函数在主题里，后来考虑到适用性时放弃了，因为如果写代码与Cool Tags这个插件来比，反而不如Cool Tags方便。
 
下面我就说说关于实现彩色标签云的方法。我们从网上大多可以得到如下的彩色标签云原生代码：
//彩色标签云函数开始
function colorCloud($text) {
  $text = preg_replace_callback('&#124;&#60;a (.+?)&#62;&#124;i', 'colorCloudCallback', $text);
  return $text;
}
function colorCloudCallback($matches) {
  $text = $matches[1];
  $color = dechex(rand(0,16777215));
  $pattern = '/style=(\'&#124;\&#34;)(.*)(\'&#124;\&#34;)/i';
  $text = preg_replace($pattern, &#34;style=\&#34;color:#{$color};$2;\&#34;&#34;, $text);
  return &#34;&#60;a $text&#62;&#34;;
}
add_filter('wp_tag_cloud', 'colorCloud', 1); 
这段代码从表面上确实实现了让标签云变为彩色的，但在实际使用当中却很容易发现，其实现的是随机色彩，也就是说每一个标签都随机的生成了一个色彩，如果放在主题里，样式是非常凌乱的，可以说效果有了，但也乱了浏览者的眼睛，而如果你不想使用更加强大但在标签色彩上相对简单的Simple Tags插件，或你不想要那种炫而又炫的云效果呢？那我们就转过来看看Cool Tags吧，这个插件很简单，我试分析如下：
  首先，Cool Tags通过插件的option设置功能来设置了五个不同热度的颜色，这段代码就省略不说了。
其次，Cool Tags通过widget的option方式提供了最多显示标签数、最大字号、最小字号、字号单位、排序等的设置，其实这段的设置主要是为WordPress的标签云输出函数wp_tag_cloud来提供参数的，以便让wp_tag_cloud函数更好的显示这些标签，那么关键的东西来了，对不同热度进行分级上色，看如下代码：

1
2
3
4
5
6
7
8
9
10
function setSpeed&#40;$num,$fontSizeNum [...]]]></description>
			<content:encoded><![CDATA[<p>标签云大家都在使用，各种插件也不少，其中比较突出比较有名的两款插件Simple Tags和WP Cumulus几乎是大家的标配了，Simple Tags这个插件可以说功能非常强大，包括热度、内链、样式规范等都非常强，而WP Cumulus则注重在华丽方面，以一种3D的方式来表现标签，更生动化的体现了标签云的函义，而第三款国人开发的插件Cool Tags则是一个非常短小精悍的插件，它功能不多，但更注重在表现方面，比如字体大小样式的规范化和热度色彩的区分。曾经写主题的时候考虑到标签云的样式问题，也曾想自己写一段函数在主题里，后来考虑到适用性时放弃了，因为如果写代码与Cool Tags这个插件来比，反而不如Cool Tags方便。</p>
<p> <span id="more-6"></span>
<p>下面我就说说关于实现彩色标签云的方法。我们从网上大多可以得到如下的彩色标签云原生代码：</p>
<pre>//彩色标签云函数开始
function colorCloud($text) {
  $text = preg_replace_callback('|<span style="color: #0000ff">&lt;</span><span style="color: #800000">a</span> (.+?)<span style="color: #0000ff">&gt;</span>|i', 'colorCloudCallback', $text);
  return $text;
}
function colorCloudCallback($matches) {
  $text = $matches[1];
  $color = dechex(rand(0,16777215));
  $pattern = '/style=(\'|\&quot;)(.*)(\'|\&quot;)/i';
  $text = preg_replace($pattern, &quot;style=\&quot;color:#{$color};$2;\&quot;&quot;, $text);
  return &quot;<span style="color: #0000ff">&lt;</span><span style="color: #800000">a</span> $<span style="color: #ff0000">text</span><span style="color: #0000ff">&gt;</span>&quot;;
}
add_filter('wp_tag_cloud', 'colorCloud', 1); </pre>
<p>这段代码从表面上确实实现了让标签云变为彩色的，但在实际使用当中却很容易发现，其实现的是随机色彩，也就是说每一个标签都随机的生成了一个色彩，如果放在主题里，样式是非常凌乱的，可以说效果有了，但也乱了浏览者的眼睛，而如果你不想使用更加强大但在标签色彩上相对简单的Simple Tags插件，或你不想要那种炫而又炫的云效果呢？那我们就转过来看看Cool Tags吧，这个插件很简单，我试分析如下：<br />
  <br />首先，Cool Tags通过插件的option设置功能来设置了五个不同热度的颜色，这段代码就省略不说了。</p>
<p>其次，Cool Tags通过widget的option方式提供了最多显示标签数、最大字号、最小字号、字号单位、排序等的设置，其实这段的设置主要是为WordPress的标签云输出函数wp_tag_cloud来提供参数的，以便让wp_tag_cloud函数更好的显示这些标签，那么关键的东西来了，对不同热度进行分级上色，看如下代码：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> setSpeed<span style="color: #009900;">&#40;</span><span style="color: #000088;">$num</span><span style="color: #339933;">,</span><span style="color: #000088;">$fontSizeNum</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$fontSizeNum</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$num</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #000088;">$fontSizeNum</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">/</span><span style="color: #000088;">$fontSizeNum</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&gt;=</span> <span style="color: #000088;">$num</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">/</span><span style="color: #000088;">$fontSizeNum</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$num</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #000088;">$i</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>这段函数代码主要实现了步进，下面这段代码中调用了它，并进一步上色：</p>
<p></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> cooltags<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$tag_min_size</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//默认最小字体</span>
  <span style="color: #000088;">$tag_max_size</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">22</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//默认最大字体</span>
  <span style="color: #000088;">$fontSizeNum</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//热度等级</span>
  <span style="color: #666666; font-style: italic;">//默认颜色</span>
  <span style="color: #000088;">$colors</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;#ccc&quot;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;#555&quot;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;#06c&quot;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;#468c00&quot;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;#f60&quot;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">5</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;#f00&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #666666; font-style: italic;">//如果更改了热度颜色，下面会开始使用用户定义的颜色</span>
  <span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;x-small&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;#555&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;small&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;#06c&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;medium&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;#468c00&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;large&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;#f60&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;x-large&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;#f00&quot;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$num_tags_all</span> <span style="color: #339933;">=</span> wp_count_terms<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post_tag'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$num_all</span> <span style="color: #339933;">=</span> number_format_i18n<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$num_tags_all</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$fontSizeSpeed</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$tag_max_size</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$tag_min_size</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$fontSizeNum</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$str_pattern</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/(\&lt;a(.*?)\&lt;\/a\&gt;)/is&quot;</span><span style="color: #339933;">;</span> 
  <span style="color: #666666; font-style: italic;">//下面这段分析标签云输出函数给出的数据</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str_pattern</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$counts</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$hcontent</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$sc</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(\&lt;a(.*?)\&gt;)/is'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$hcontent</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matcht</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$sc</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$htitle</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$matcht</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/title=\'(\d).*?\'/is'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$htitle</span><span style="color: #339933;">,</span> <span style="color: #000088;">$match</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$tag_num</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$match</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #000088;">$counts</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tag_num</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #666666; font-style: italic;">//对标签云给出的数据进行重组重写</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str_pattern</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$hcontent</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$num_tags_speed</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$counts</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">/</span> <span style="color: #990000;">max</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$counts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$fontColor</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$colors</span><span style="color: #009900;">&#91;</span>setSpeed<span style="color: #009900;">&#40;</span><span style="color: #000088;">$num_tags_speed</span><span style="color: #339933;">,</span><span style="color: #000088;">$fontSizeNum</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$newStyle</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;style='color:<span style="color: #006699; font-weight: bold;">{$fontColor}</span>;<span style="color: #006699; font-weight: bold;">$2</span>'&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$oldStyle</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/(style='(.*?)')/is&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$newtext</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$oldStyle</span><span style="color: #339933;">,</span><span style="color: #000088;">$newStyle</span><span style="color: #339933;">,</span><span style="color: #000088;">$hcontent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$a</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$newtext</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;ul class='wp-tag-cloud'&gt;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$textnew</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;ul class='wp-tag-cloud'&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;li&gt;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$textnew</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">join</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;&lt;/li&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;li&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$a</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$textnew</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/li&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;/ul&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$textnew</span> <span style="color: #339933;">=</span> <span style="color: #990000;">join</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #000088;">$text</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;textarea&gt;&quot;</span><span style="color: #339933;">.</span>setSpeed<span style="color: #009900;">&#40;</span><span style="color: #000088;">$num_tags_speed</span><span style="color: #339933;">,</span><span style="color: #000088;">$fontSizeNum</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/textarea&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #666666; font-style: italic;">//输出</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$textnew</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_tag_cloud'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'cooltags'</span><span style="color: #339933;">,</span>  <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//实现输出</span></pre></td></tr></table></div>

<p>上面的代码完成了最终的工作，嗯，我没有细化的去分解注释，主要是因为我对PHP中的一些东西不是很熟，很多时候还需要查手册，再一个我的目的是提出一种思路，或去分析别人的思路给大家，让大家有一种自己也能做插件的愿望和想法，授之与鱼不如授之与渔，简单的一个标签云，根据大家的立意不同，可以做出不同种的插件，那么这就是一种想法和愿望，而通过不同的路径来实现，不同的算法，不同的逻辑顺序即使结果是相同的，但也会有不同的代码效率。呵呵，希望大家能够通过看代码和比较插件功能来提高自己，更希望大家将自己的想法转化为实际的插件来丰富更多的WordPress的使用者。</p>
<p><small><strong>Statement:</strong> Site follow the <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Attribution-Noncommercial-Share Alike 3.0 Unported</a> agreement. Reprinted please specify switched </small><a href="http://verylifes.com/2009/color-tag-cloud-realization-and-simple-tags-cool-tags-wp-cumulus-tag-cloud-plugin-comparison-of-three.html">Very Life</a></p>
]]></content:encoded>
			<wfw:commentRss>http://verylifes.com/2009/color-tag-cloud-realization-and-simple-tags-cool-tags-wp-cumulus-tag-cloud-plugin-comparison-of-three.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>原生代码对 Ozh&#8217; Better Feed</title>
		<link>http://verylifes.com/2009/native-code-to-ozh-better-feed.html</link>
		<comments>http://verylifes.com/2009/native-code-to-ozh-better-feed.html#comments</comments>
		<pubDate>Sat, 07 Nov 2009 07:14:00 +0000</pubDate>
		<dc:creator>whitewords</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Feed]]></category>
		<category><![CDATA[Ozh' Better Feed]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[原生代码]]></category>
		<category><![CDATA[插件]]></category>

		<guid isPermaLink="false">http://verylifes.com/2009/native-code-to-ozh-better-feed.html</guid>
		<description><![CDATA[闲话少述，先来说说Ozh' Better Feed的功能，Ozh' Better Feed最主要的功能是对你的WordPress文章的RSS系统添加版权标识，这些版权标识是由你在设置里进行格式设置的，除此之外，它还支持在版权标识后面输出评论数量、标签、社会化书签等内容，这些所显示的内容完全是可自己定义编辑的。那么我们就看看如何用原生代码来简单的替代它吧。]]></description>
			<content:encoded><![CDATA[<p>说实话，这个有点标题党了，因为我提供的原生代码没有Ozh&#8217; Better Feed原功能那么强大，因为使用Ozh&#8217; Better Feed对我来讲完全的意义就是对抗RSS采集站，而且这段简单的代码很多地方都有过介绍，我只是尽可能的将其格式化，并做好宣传工作。</p>
<p>闲话少述，先来说说Ozh&#8217; Better Feed的功能，Ozh&#8217; Better Feed最主要的功能是对你的WordPress文章的RSS系统添加版权标识，这些版权标识是由你在设置里进行格式设置的，除此之外，它还支持在版权标识后面输出评论数量、标签、社会化书签等内容，这些所显示的内容完全是可自己定义编辑的。那么我们就看看如何用原生代码来简单的替代它吧。</p>
<p> <span id="more-5"></span>
<p>打开您主题所在文件夹，找到 <font color="#ff0000">functions.php</font> 文件，打开并编辑。在这里我再多说两句，一个是一定要注意细节，比如空格或者我说过需要注意的地方，再一个是一定要注意保存为“<font color="#ff0000">UTF-8编码无BOM格式</font>”，还有一点就是我所提供的这些都曾经或者仍然在我的主题里运行着的代码，好了，在文件尾部的 ?&gt; 之前加上如下代码：    </p>
<pre>function insert_feedinfo($content){
  if (is_feed()){//如果是feed内容
    $insert = '<span style="color: #0000ff">&lt;</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;</span>';
    $insert .= '';//引号间写入你想加入的信息
/*比如我加的信息如下：
//<span style="color: #0000ff">&lt;</span><span style="color: #800000">small</span><span style="color: #0000ff">&gt;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">strong</span><span style="color: #0000ff">&gt;</span>Statement:<span style="color: #0000ff">&lt;/</span><span style="color: #800000">strong</span><span style="color: #0000ff">&gt;</span> Site follow the
// <span style="color: #0000ff">&lt;</span><span style="color: #800000">a</span> <span style="color: #ff0000">href</span>=<span style="color: #0000ff">&quot;http://creativecommons.org/licenses/by-nc-sa/3.0/&quot;</span><span style="color: #0000ff">&gt;</span>
//Attribution-Noncommercial-Share Alike 3.0 Unported
//<span style="color: #0000ff">&lt;/</span><span style="color: #800000">a</span><span style="color: #0000ff">&gt;</span> agreement. Reprinted please specify switched <span style="color: #0000ff">&lt;/</span><span style="color: #800000">small</span><span style="color: #0000ff">&gt;</span>
*/
    $insert .= '<span style="color: #0000ff">&lt;</span><span style="color: #800000">a</span> <span style="color: #ff0000">href</span>=<span style="color: #0000ff">&quot;';
    $insert .= get_permalink();//文章的链接
    $insert .= '&quot;</span><span style="color: #0000ff">&gt;</span>';
    $insert .= get_option('blogname');//博客的名称
    $insert .= '<span style="color: #0000ff">&lt;/</span><span style="color: #800000">a</span><span style="color: #0000ff">&gt;</span>' . '<span style="color: #0000ff">&lt;/</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;</span>' . &quot;\n&quot;;
    $content = $content . $insert;
  }
  return $content;
}
add_filter('the_content','insert_feedinfo');</pre>
<p>在 <font color="#0000ff">$insert</font> 里是我们要添加的信息，除去文章的链接、博客的名称和你需要放入的文字信息之外，如果还需要加别的信息，您完全可以自己再进行添加。怎么样，这个看起来很简单了吧，呵呵，虽然我们没有什么其它想法，但我们确实比较讨厌RSS采集，有朋友说：人家能够采集你，也证明你的东西有值得采集的地方。嗯，是啊，但你自己写的东西被人家一句代码就引为了原创，呵，那感觉，实在不爽。好了，就到这里，今天非常简单。</p>
<p><small><strong>Statement:</strong> Site follow the <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Attribution-Noncommercial-Share Alike 3.0 Unported</a> agreement. Reprinted please specify switched </small><a href="http://verylifes.com/2009/native-code-to-ozh-better-feed.html">Very Life</a></p>
]]></content:encoded>
			<wfw:commentRss>http://verylifes.com/2009/native-code-to-ozh-better-feed.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用原生代码替换ALL IN ONE SEO PACK</title>
		<link>http://verylifes.com/2009/replace-the-code-with-the-native-all-in-one-seo-pack.html</link>
		<comments>http://verylifes.com/2009/replace-the-code-with-the-native-all-in-one-seo-pack.html#comments</comments>
		<pubDate>Fri, 06 Nov 2009 08:23:44 +0000</pubDate>
		<dc:creator>whitewords</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[ALL IN ONE SEO PACK]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[原生代码]]></category>
		<category><![CDATA[插件]]></category>

		<guid isPermaLink="false">http://verylifes.com/2009/replace-the-code-with-the-native-all-in-one-seo-pack.html</guid>
		<description><![CDATA[SEO，一个被无数博客作者浏览的高关键词，呵，它何以这么抢手？当然是由于它是搜索引擎最佳化的缩写，写博客非要针对搜索引擎来写吗？干嘛不能写给自己？你当然可以写给自己或自己的一个小圈子，再或者奉献给大众，但每一个公开的博客都或多或少的去优化一下自己对搜索引擎的友好度，以便提升自己网站在搜索引擎面前的知名度，最终提升自己的流量。呵，于是乎你SEO，我SEO，他也SEO，各种SEO的工具也油然而生，而在WordPress这个博客平台里，ALL IN ONE SEO PACK这个SEO优化插件无疑是最热门的，它都能做什么呢？简单说一下，因为大家都用得太多了。

ALL IN ONE SEO PACK可以：
1、可以给每篇文章添加独立的关键词；
2、可以给每篇文章添加独立的meta标签；
3、可以给每篇文章添加独立的description；
4、可以给每篇文章添加独立的摘要；
5、可以给每篇文章自动生成摘要；
6、可以防止存档页和首页的内容被抓取，从而防止因重复内容被google降权；
看，够优秀的吧，可无论一个插件如何的优秀，总还是有种种理由让我们不想使用它，比如ALL IN ONE SEO PACK与Simple Tagging在某一方面有冲突，再比如某些热爱纯净的朋友或折腾代码的朋友从心底的抵制，那么非要它不可吗？当然不是，ALL IN ONE SEO PACK也不过是个插件，也不过是由代码来写的，既然这样，我们就在自己的主题里添加一下吧，让我们也自己原生一下。
写之前要注意几点：
1、我所提供的代码不是我的原创，有很多是网上传抄的，我只是尽可能的合理安排结构和功能，让它看起来更直观简捷，又不失主体功能。
2、无论您用哪一种编辑器去写这些代码，我一再要提醒您，保存时要选对格式：UTF-8无BOM格式保存。
3、您所添加的所有代码都会在主题文件中操作，一旦您更换了主题，并且还需要这些代码，请务必要复制回来。
4、这些代码不是最好的，或许您有更多更好的方法，欢迎您来一起讨论。
好了，就这些，有问题可以在我的小博上留言，我会尽快回复的，下面我们来开始代码。
代码段一：
这段不算是个代码段，只能算是个注意吧，打开您主题文件中的 header.php 文件，在&#60;/head&#62; 之前要注意有如下代码：

1
&#60;?php wp_head&#40;&#41;; ?&#62;

代码段二：
打开您主题文件中的 functions.php 文件，在文件尾部的 ?&#62; 之前加上如下代码：

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// get categories name
function get_cats_name&#40;&#41; &#123;
  $allcats=get_categories&#40;&#41;;
  foreach &#40;$allcats as $category&#41; 
  &#123;
    $keywords&#91;&#93; = $category-&#62;cat_name;
  &#125;
  return $keywords;
&#125;
// utf8 substr
function [...]]]></description>
			<content:encoded><![CDATA[<p>SEO，一个被无数博客作者浏览的高关键词，呵，它何以这么抢手？当然是由于它是搜索引擎最佳化的缩写，写博客非要针对搜索引擎来写吗？干嘛不能写给自己？你当然可以写给自己或自己的一个小圈子，再或者奉献给大众，但每一个公开的博客都或多或少的去优化一下自己对搜索引擎的友好度，以便提升自己网站在搜索引擎面前的知名度，最终提升自己的流量。呵，于是乎你SEO，我SEO，他也SEO，各种SEO的工具也油然而生，而在WordPress这个博客平台里，ALL IN ONE SEO PACK这个SEO优化插件无疑是最热门的，它都能做什么呢？简单说一下，因为大家都用得太多了。<br />
<span id="more-4"></span><br />
ALL IN ONE SEO PACK可以：<br />
1、可以给每篇文章添加独立的关键词；<br />
2、可以给每篇文章添加独立的meta标签；<br />
3、可以给每篇文章添加独立的description；<br />
4、可以给每篇文章添加独立的摘要；<br />
5、可以给每篇文章自动生成摘要；<br />
6、可以防止存档页和首页的内容被抓取，从而防止因重复内容被google降权；</p>
<p>看，够优秀的吧，可无论一个插件如何的优秀，总还是有种种理由让我们不想使用它，比如ALL IN ONE SEO PACK与Simple Tagging在某一方面有冲突，再比如某些热爱纯净的朋友或折腾代码的朋友从心底的抵制，那么非要它不可吗？当然不是，ALL IN ONE SEO PACK也不过是个插件，也不过是由代码来写的，既然这样，我们就在自己的主题里添加一下吧，让我们也自己原生一下。</p>
<p>写之前要注意几点：<br />
1、我所提供的代码不是我的原创，有很多是网上传抄的，我只是尽可能的合理安排结构和功能，让它看起来更直观简捷，又不失主体功能。<br />
2、无论您用哪一种编辑器去写这些代码，我一再要提醒您，保存时要选对格式：UTF-8无BOM格式保存。<br />
3、您所添加的所有代码都会在主题文件中操作，一旦您更换了主题，并且还需要这些代码，请务必要复制回来。<br />
4、这些代码不是最好的，或许您有更多更好的方法，欢迎您来一起讨论。<br />
好了，就这些，有问题可以在我的小博上留言，我会尽快回复的，下面我们来开始代码。</p>
<p>代码段一：<br />
这段不算是个代码段，只能算是个注意吧，打开您主题文件中的 <span style="color: #ff0000;">header.php</span> 文件，在&lt;/head&gt; 之前要注意有如下代码：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_head<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>代码段二：<br />
打开您主题文件中的 <span style="color: #ff0000;">functions.php</span> 文件，在文件尾部的 ?&gt; 之前加上如下代码：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// get categories name</span>
<span style="color: #000000; font-weight: bold;">function</span> get_cats_name<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$allcats</span><span style="color: #339933;">=</span>get_categories<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$allcats</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$category</span><span style="color: #009900;">&#41;</span> 
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$keywords</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_name</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$keywords</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// utf8 substr</span>
<span style="color: #000000; font-weight: bold;">function</span> utf8Substr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #339933;">,</span> <span style="color: #000088;">$from</span><span style="color: #339933;">,</span> <span style="color: #000088;">$len</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'</span><span style="color: #339933;">.</span><span style="color: #000088;">$from</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'}'</span><span style="color: #339933;">.</span>
                      <span style="color: #0000ff;">'((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'</span><span style="color: #339933;">.</span><span style="color: #000088;">$len</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'}).*#s'</span><span style="color: #339933;">,</span>
                      <span style="color: #0000ff;">'$1'</span><span style="color: #339933;">,</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// Meta SEO</span>
<span style="color: #000000; font-weight: bold;">function</span> meta_SEO<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//如果是文章页</span>
    <span style="color: #000088;">$keywords</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_excerpt</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//如果文章摘要存在就以文章摘要为描述</span>
      <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_excerpt</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$description</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$description</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$description</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$description</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'...'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//如果文章摘要不存在就截断文章前200字为描述</span>
      <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> utf8Substr<span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$description</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$description</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$description</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$description</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'...'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>     
    <span style="color: #000088;">$tags</span> <span style="color: #339933;">=</span> wp_get_post_tags<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//取文章标签</span>
    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$tag</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$keywordarray</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tag</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">//以文章标签为关键字</span>
    <span style="color: #000088;">$keywords</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span><span style="color: #990000;">array_unique</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#41;</span><span style="color: #000088;">$keywordarray</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//如果不是文章页</span>
    <span style="color: #000088;">$keywords</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//在引号间写入你博客的关键字用,断开</span>
    <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//在引号间写入你博客的简单描述，不要过200字</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$keywords</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//如果没写博客的关键字则以分类名为值</span>
      <span style="color: #000088;">$keywords</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span><span style="color: #990000;">array_unique</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#41;</span>get_cats_name<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> 
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$description</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//如果没写博客的描述则以副标题为值</span>
      <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'blogdescription'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> 
  <span style="color: #009900;">&#125;</span>
  <span style="color: #666666; font-style: italic;">//输出描述</span>
  <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;meta name=&quot;description&quot; content=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$description</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; /&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #666666; font-style: italic;">//输出关键字</span>
  <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;meta name=&quot;keywords&quot; content=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$keywords</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; /&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> OR is_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> OR is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//如果是文章、分页、首页则允许robots</span>
    <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span><span style="color: #0000ff;">'&lt;meta name=&quot;robots&quot; content=&quot;index,follow,noarchive&quot; /&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//如果不是则不允许</span>
    <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span><span style="color: #0000ff;">'&lt;meta name=&quot;robots&quot; content=&quot;noindex,follow,noarchive&quot; /&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span><span style="color: #0000ff;">'&lt;meta name=&quot;googlebot&quot; content=&quot;noarchive&quot; /&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$output</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'meta_SEO'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//添加meta_SEO函数到头部信息里</span></pre></td></tr></table></div>

<p>好了，正确保存后就OK了，我想需要注意或需要解释的我都写了注释了，呵，如果还是不很明白，可以问我。就这样，一个原生的，简单的SEO就写好了，如果你的主题很标准，那么事实上你只需在 functions.php 这个文件里稍加操作就可以了，很简单吧，呵，如果你写自己的一个主题，那么也完全可以用进去，当然，你要是想发布主题的话，我想你已经是个高手了，应当知道如何更加优化和提供更改的设置。好啦，跟着某些人来说一句：我们的目标！纯净原生！:grin: </p>
<p><small><strong>Statement:</strong> Site follow the <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Attribution-Noncommercial-Share Alike 3.0 Unported</a> agreement. Reprinted please specify switched </small><a href="http://verylifes.com/2009/replace-the-code-with-the-native-all-in-one-seo-pack.html">Very Life</a></p>
]]></content:encoded>
			<wfw:commentRss>http://verylifes.com/2009/replace-the-code-with-the-native-all-in-one-seo-pack.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>WordPress,插件和原生代码,你选哪一个?</title>
		<link>http://verylifes.com/2009/wordpress-plug-in-and-native-code-you-choose-which-one.html</link>
		<comments>http://verylifes.com/2009/wordpress-plug-in-and-native-code-you-choose-which-one.html#comments</comments>
		<pubDate>Thu, 05 Nov 2009 05:16:00 +0000</pubDate>
		<dc:creator>whitewords</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[优势]]></category>
		<category><![CDATA[原生代码]]></category>
		<category><![CDATA[对比]]></category>
		<category><![CDATA[插件]]></category>

		<guid isPermaLink="false">http://verylifes.com/2009/wordpress-plug-in-and-native-code-you-choose-which-one.html</guid>
		<description><![CDATA[我们到底是要用插件还是用原生代码？插件比原生代码的优势在于哪些？那为什么还要有原生代码？]]></description>
			<content:encoded><![CDATA[<p>玩WordPress也有一阵子了，纯是个折腾，用过许多的插件，也自己弄过皮肤，也写过两个插件，于是开始有了一些疑问，正如很多博友都在争论的，我们到底是要用插件还是用原生代码？</p>
<p>其实这还真不算个问题，爱用哪个用哪个吧，可要是真细想起来，这又是个很重要的问题，依据六秒定律，我的博由于使用了大量的插件，在六秒内不一定能够完全展示在大家的面前，那为什么有人就行呢？嗯，这里还有一个网速问题，比如我的空间都是在国外的，那堆数据包不远万里来到中国，颇有白大夫的国际主义精神，与国内的那些三线、双线机房比不了啊，呵呵。</p>
<p> <span id="more-3"></span>
<p>先说说插件比原生代码的优势吧：   <br />我们为什么要选择插件？因为插件提供了一些增强性的博客功能，其实这些功能原生代码也完全可以做到，但几乎所有的原生代码需要修改到你的皮肤（或说主题）文件中，一旦你换掉了现用的主题，那么你要重新去添加那些原生代码，而插件则不需要这样，无论你换哪个主题，插件该有的功能依然存在，或许不需要你改动任何地方，或许你只要稍稍改动你的主题就完全可以，这是插件比原生代码优势之一；    <br />优势之二，可定制性与通用性。插件之所以能够公开发布，并让任何一个博客来使用，其最大的功效是option，所谓option其实就是修改插件的设置参数，并将这些参数应用到插件里，大部分插件都提供了option设置，仅有一小部分插件因无需参数或功能单一而省略或不必去进行特别设置，有了这个option之后，你、我、他，我们每一个使用这个插件的人都可以根据自己的需要来进行设置，这些可以说是原生代码所不能做到的，或者是没有必要做到的，因为什么呢？原生代码在于自我性，其通用性比较差，因为并不是所有的人都懂在哪里加入代码，并不是所有人都有折腾代码的癖好。从定制性来讲，虽然原生代码也可以去写个option，但有那必要吗？如果那样，就发布成插件让大家使用吧，对于自己使用的情况，如果你做了option设定，并通过option来修改你的设置，那与直接修改代码又有什么大的区别呢？    <br />优势三，升级、维护与卸载。其实这方面的优势与第一优势的主题是几乎相同的，笼统的说就是方便，作为一个插件，无论是在调试、修改或者放弃都是非常方便的，不用就删了它，修改或调试只要打开插件的文件就可以了，相比之下原生代码却要一次又一次的去在主题文件或其它文件里翻找，说不定还会与某个函数冲突，呵，曾经做我那第一个主题时我就碰到过这样的事情。</p>
<p>由以上来看，插件比原生代码可要好多了？也不一定，我们再来看看它的不足之处吧。   <br />不足之一，过于庞大。一个好的插件除去考虑其主要功能外，最需要考虑的一点就是公用性（通用性），你所发布的插件（这里单指WordPress的插件）可能会用到任何一个版本的WordPress里，每一次的WordPress升级都会有可能某个WordPress公共函数被放弃或被改变，那么你的插件是否能适应？不能适应也就会被用户放弃，于是，为了能有良好的通用性，你不得不考虑周全，将PHP5支持的与PHP4不支持的一些函数通过自己的代码来实现，将WordPress某版本以下不支持的函数也转换一种方式，那么这样一来，可能一个小小的问题仅需两三句代码就能搞定的事情，在你的插件里要多出许多，由此就会造成体积庞大，代码冗余，但这些却完全不能避免，很无奈。原生代码则没有这个弊病，因为这个原生代码是为你单独定制的，而且大多原生代码都本着简单化的原则来写。    <br />不足之二，加载外部JS代码过多。很多不错的插件都有加载一些JS，或者因为方便，或者因为习惯，再或者因为必需。而对于使用者来说，如果一个站使用了过多的插件，而这些插件又大部分都有自己的JS加载，那么通不过六秒定律的站可能会很多很多，除去这一原因之外，很多插件都加载了一些公用的JS，但不是每个插件都能完全精准的判断那些公用JS是否被其它插件已经加载了，于是重复加载（这点我只是猜想，因为我没有碰到过，所谓的重复加载只是逻辑理论上的假说），这样一来你的一个小小的博客又添上了重负。而原生代码由于定制了一些东西，即使加载某个JS，也会要考虑现有的环境，或者将JS加到已加载的其它JS里，或者仅在需要是加载。    <br />不足三，功能过于周全却不实用。可能大家都碰到过这个问题，某个插件非常好，大家公认的好，但真的装上了却不是那么回事，为什么？因为每个人的应用点不同，同一个插件，你可能只用到它的A功能，而它的B功能你可能觉得不如另一个插件，于是你启用了两个插件，或者因为对插件和WordPress的不熟悉，一个非常好的插件在你眼里只需要其中单一或所有功能中的一部分。这样一来，每一个插件不能做到尽才而用，又是过于浪费了。于是你总是会想，为什么某某插件不能就写这一个或这几个功能呢？当然不能啊，插件的作者有自己的想法，有考虑其使用性的想法，有扩大化想法，那么当然是越全越好，越能尽多利用插件本身代码优势越好。原生代码呢？没有这些烦恼，你用一，那就加一，用二就加二，用什么加什么，不存在这些问题，呵，因为它是为你定制的。</p>
<p>说了这么多，插件与原生代码孰优孰劣？呵，实话说，没有优劣之分，完全是看使用者的考虑了，你需要，那它就是优，你不需要那它就是劣。在今后的文章中，我可能会写一些插件与原生代码的对比，当然，所谓的对比也只是我个人的分析，毕竟能力有限，也就当是给大家的扫盲贴，好了，下次见。</p>
<p><small><strong>Statement:</strong> Site follow the <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Attribution-Noncommercial-Share Alike 3.0 Unported</a> agreement. Reprinted please specify switched </small><a href="http://verylifes.com/2009/wordpress-plug-in-and-native-code-you-choose-which-one.html">Very Life</a></p>
]]></content:encoded>
			<wfw:commentRss>http://verylifes.com/2009/wordpress-plug-in-and-native-code-you-choose-which-one.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Hello world！</title>
		<link>http://verylifes.com/2009/hello-world.html</link>
		<comments>http://verylifes.com/2009/hello-world.html#comments</comments>
		<pubDate>Wed, 04 Nov 2009 03:20:59 +0000</pubDate>
		<dc:creator>whitewords</dc:creator>
				<category><![CDATA[闲说闲话]]></category>

		<guid isPermaLink="false">http://verylifes.com/wdp/?p=1</guid>
		<description><![CDATA[欢迎使用 WordPress 。这是系统自动生成的演示文章。编辑或者删除它，开始您的博客！
Statement: Site follow the Attribution-Noncommercial-Share Alike 3.0 Unported agreement. Reprinted please specify switched Very Life
]]></description>
			<content:encoded><![CDATA[<p>欢迎使用 WordPress 。这是系统自动生成的演示文章。编辑或者删除它，开始您的博客！</p>
<p><small><strong>Statement:</strong> Site follow the <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Attribution-Noncommercial-Share Alike 3.0 Unported</a> agreement. Reprinted please specify switched </small><a href="http://verylifes.com/2009/hello-world.html">Very Life</a></p>
]]></content:encoded>
			<wfw:commentRss>http://verylifes.com/2009/hello-world.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
