<?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>iPUNKID &#187; Wordpress</title>
	<atom:link href="http://blog.punkid.org/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.punkid.org</link>
	<description>To ∞ and Beyond</description>
	<lastBuildDate>Sun, 29 Jan 2012 13:02:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>如何整站迁移WP</title>
		<link>http://blog.punkid.org/2010/01/12/how-to-move-your-wordpress-seamlessly/</link>
		<comments>http://blog.punkid.org/2010/01/12/how-to-move-your-wordpress-seamlessly/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 09:16:07 +0000</pubDate>
		<dc:creator>iPUNKID</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[301]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=345</guid>
		<description><![CDATA[由于某人为因素，本站从blog.punkid.cn迁移到了blog.punkid.org。原以为是个大工程，结果从域名购买，DNS解析到Wordpress搬迁两个小时就搞定了。下面是一些搬迁过程中的经验技巧，希望对cn钉子户们有一定帮助。 域名购买 打死我也不在国内域名商那买域名了，除了某些因素不说，光是续费就够麻烦的，你得找原注册商那续费，而且想要进行域名转移的话，还要提交身份证信息等纸质凭证给原域名商进行核实。买域名还是老老实实的选家国外的注册机构吧，千万别贪国内那些域名商给你的小恩小惠。我是godaddy注册的，然后google了下coupon codes，从48美元打折到了36美元左右，缴费方式支持paypal以及国内的支付宝，所以没有双币信用卡进行美元支付的话也没关系。 另外，godaddy很多域名是第一年便宜，但是之后的年费比较贵，像.me结尾的域名首年才8美元，但是之后每年要支付20美元，我索性选择了传统的.org域名，每年老老实实交个15美元得了。 备份，修改WP数据库 WP后台就有数据库的备份选项，一定要时常备份，以备不测。因为域名修改了，我要把数据库里的原域名地址全部更换为新域名地址，简单的办法是利用*unix的sed工具替换，它非常的快，而且不用打开文本编辑器等待庞大的数据库文件全部读取完。 $ sed -i 's/blog\.punkid\.cn/blog\.punkid\.org/gi' databasename.sql 然后利用phpmyadmin导入进去就可以了。 搬动Wordpress文件夹 很简单，我是直接cp -r blog.punkid.cn/* blog.punkid.cn/.* blog.punkid.org/搞定的，复制完之后最好确认下那些隐藏文件是否都复制过去了，例如.htaccess 利用301重定向旧域名到新域名 更改域名最怕的是原在旧域名下被google, yahoo, bing索引的地址不能立刻转移到新域名下，除了重建sitemap通知google爬虫来重新抓取之外，利用到301永久重定向也是很重要的。我的目标自然是把旧域名下的链接全部自动重定向到新域名下面，例如我的这篇文件Ultimate Guide to Manage Your iPod under Linux : Revised，每个月都有很大程度的浏览量来自于google的索引。如何保证访问者即使输入旧的地址http://blog.punkid.cn/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux也能自动重定向到http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux呢？ 在原域名(blog.punkid.cn)的目录下添加.htaccess文件，里面写入: &#60;IfModule mod_rewrite.c&#62; Options +FollowSymlinks RewriteEngine On RewriteRule ^(.*)$ http://blog.punkid.org/$1 [R=301,NC] &#60;/IfModule&#62; 搞定，剩下的让google来完成吧。 迁移awstat访问统计数据 我一直都在用awstat的访问统计，现在迁移到新的域名下，除了修改awstat的conf文件，还要把就域名下的访问统计数据移到新域名下。好在awstat的访问统计数据都是文本形式保存在awstats/awdata目录下，而且每月数据都是以诸如awstats112007.blog.punkid.cn.txt的文件名存在的，不用多解释了，把这么多文件全部替换为新域名blog.punkid.org就行了，不需要文件名批处理软件，*unix下一个rename命令就搞定了。 $ rename -v 's/punkid\.cn/punkid\.org/' *.txt End 暂时就这么多，目前来看搬迁后还没出现什么问题。另外，本站在Going HTML5，Going [...]]]></description>
			<content:encoded><![CDATA[<p>由于某人为因素，本站从blog.punkid.cn迁移到了blog.punkid.org。原以为是个大工程，结果从域名购买，DNS解析到Wordpress搬迁两个小时就搞定了。下面是一些搬迁过程中的经验技巧，希望对cn钉子户们有一定帮助。</p>
<h3>域名购买</h3>
<p>打死我也不在国内域名商那买域名了，除了某些因素不说，光是续费就够麻烦的，你得找原注册商那续费，而且想要进行域名转移的话，还要提交身份证信息等纸质凭证给原域名商进行核实。买域名还是老老实实的选家国外的注册机构吧，千万别贪国内那些域名商给你的小恩小惠。我是godaddy注册的，然后google了下<em>coupon codes</em>，从48美元打折到了36美元左右，缴费方式支持paypal以及国内的支付宝，所以没有双币信用卡进行美元支付的话也没关系。</p>
<p>另外，godaddy很多域名是第一年便宜，但是之后的年费比较贵，像.me结尾的域名首年才8美元，但是之后每年要支付20美元，我索性选择了传统的.org域名，每年老老实实交个15美元得了。<br />
<span id="more-345"></span></p>
<h3>备份，修改WP数据库</h3>
<p>WP后台就有数据库的备份选项，一定要时常备份，以备不测。因为域名修改了，我要把数据库里的原域名地址全部更换为新域名地址，简单的办法是利用*unix的sed工具替换，它非常的快，而且不用打开文本编辑器等待庞大的数据库文件全部读取完。</p>
<pre lang="bash">
$ sed -i 's/blog\.punkid\.cn/blog\.punkid\.org/gi' databasename.sql
</pre>
<p>然后利用phpmyadmin导入进去就可以了。</p>
<h3>搬动Wordpress文件夹</h3>
<p>很简单，我是直接<code>cp -r blog.punkid.cn/* blog.punkid.cn/.* blog.punkid.org/</code>搞定的，复制完之后最好确认下那些隐藏文件是否都复制过去了，例如<code>.htaccess</code></p>
<h3>利用301重定向旧域名到新域名</h3>
<p>更改域名最怕的是原在旧域名下被google, yahoo, bing索引的地址不能立刻转移到新域名下，除了重建sitemap通知google爬虫来重新抓取之外，利用到301永久重定向也是很重要的。我的目标自然是把旧域名下的链接全部自动重定向到新域名下面，例如我的这篇文件<a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/" title="Ultimate Guide to Manage Your iPod under Linux : Revised">Ultimate Guide to Manage Your iPod under Linux : Revised</a>，每个月都有很大程度的浏览量来自于google的索引。如何保证访问者即使输入旧的地址<code>http://blog.punkid.cn/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux</code>也能自动重定向到<code>http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux</code>呢？</p>
<p>在原域名(blog.punkid.cn)的目录下添加.htaccess文件，里面写入:</p>
<pre lang="apache">
&lt;IfModule mod_rewrite.c&gt;
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^(.*)$ http://blog.punkid.org/$1 [R=301,NC]
&lt;/IfModule&gt;
</pre>
<p>搞定，剩下的让google来完成吧。</p>
<h3>迁移awstat访问统计数据</h3>
<p>我一直都在用awstat的访问统计，现在迁移到新的域名下，除了修改awstat的conf文件，还要把就域名下的访问统计数据移到新域名下。好在awstat的访问统计数据都是文本形式保存在<code>awstats/awdata</code>目录下，而且每月数据都是以诸如<code>awstats112007.blog.punkid.cn.txt</code>的文件名存在的，不用多解释了，把这么多文件全部替换为新域名blog.punkid.org就行了，不需要文件名批处理软件，*unix下一个<code>rename</code>命令就搞定了。</p>
<pre lang="bash">
$ rename -v 's/punkid\.cn/punkid\.org/' *.txt
</pre>
<h3>End</h3>
<p>暂时就这么多，目前来看搬迁后还没出现什么问题。另外，本站在<a href="http://blog.punkid.org/2009/08/16/going-html5/" title="Going HTML5">Going HTML5</a>，<a href="http://blog.punkid.org/2009/08/25/going-mobile/" title="Going Mobile">Going Mobile</a>后对theme进行了更激进式的CSS3升级，目前来看Firefox 3.6, Google Chrome Dev和Opera 10.50下的表现各有千秋吧。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2010/01/12/how-to-move-your-wordpress-seamlessly/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Nürburgring Launchs</title>
		<link>http://blog.punkid.org/2009/06/23/nurburgring-launchs/</link>
		<comments>http://blog.punkid.org/2009/06/23/nurburgring-launchs/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 12:33:27 +0000</pubDate>
		<dc:creator>iPUNKID</dc:creator>
				<category><![CDATA[Site Log]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=319</guid>
		<description><![CDATA[上一次完整地做一个wordpress主题已经是一年前了，之后又换回了940 Grid的主题。期间一直都在自家sandbox里尝试做一些新的wordpress theme，无奈难产的太多了。这回趁着最后的假期，借助以前那些主题的框架，放弃了所有IE，放弃了Grid Layout，整个主题两天就基本搞定了。 这回比以往来的更狠，所有IE都没法正常访问了，我应用了很多CSS 2.1 ~ 3的新鲜玩意，别说IE了，就连Gecko, webkit-nightly, Presto这些引擎都没法完全识别。 推荐在Windows Vista, 7或者Linux, Mac下用Mozilla Firefox 3.5访问，原因: Windows XP在抗锯齿上实在不敢恭维，大字号有很明显的边缘不够平滑 Presto和Webkit在border-style:dotted上跟IE一样傻逼，渲染出来的都是dashed虚线 Webkit下，只要pre的字号设置为小于1em相对值，字号计算完全乱了，明明是16px * .75em = 12px，结果比10px还小。 Webkit对text-shadow的渲染没Presto, KHTML好，对border-radius的渲染比起Gecko差多了 主题还有好多问题，边用边改吧。]]></description>
			<content:encoded><![CDATA[<p>上一次完整地做一个wordpress主题已经是一年前了，之后又换回了940 Grid的主题。期间一直都在自家sandbox里尝试做一些新的wordpress theme，无奈难产的太多了。这回趁着最后的假期，借助以前那些主题的框架，放弃了所有IE，放弃了Grid Layout，整个主题两天就基本搞定了。</p>
<p>这回比以往来的更狠，所有IE都没法正常访问了，我应用了很多<abbr title="Cascading Style Sheets">CSS</abbr> 2.1 ~ 3的新鲜玩意，别说IE了，就连Gecko, webkit-nightly, Presto这些引擎都没法完全识别。</p>
<p>推荐在Windows Vista, 7或者Linux, Mac下用Mozilla Firefox 3.5访问，原因:</p>
<ol>
<li>Windows XP在抗锯齿上实在不敢恭维，大字号有很明显的边缘不够平滑</li>
<li>Presto和Webkit在<code>border-style:dotted</code>上跟IE一样傻逼，渲染出来的都是<code>dashed</code>虚线</li>
<li>Webkit下，只要<code>pre</code>的字号设置为小于<code>1em</code>相对值，字号计算完全乱了，明明是16px * .75em = 12px，结果比10px还小。</li>
<li>Webkit对<code>text-shadow</code>的渲染没Presto, KHTML好，对<code>border-radius</code>的渲染比起Gecko差多了</li>
</ol>
<p>主题还有好多问题，边用边改吧。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2009/06/23/nurburgring-launchs/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>改造WP-Syntax</title>
		<link>http://blog.punkid.org/2009/04/03/wp-syntax-improvement/</link>
		<comments>http://blog.punkid.org/2009/04/03/wp-syntax-improvement/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 07:54:54 +0000</pubDate>
		<dc:creator>iPUNKID</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wp-syntax]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=309</guid>
		<description><![CDATA[经常要往blog里贴代码，没个代码高亮实在有点落伍。找来找去，wordpress下也就WP-Syntax最好用了，支持的语言也比较多，像linux下的bash, vim都可以被高亮化。不过WP-Syntax也并非完美，有些地方和我的使用习惯相差甚远: 先来看下改造前和改造后的代码吧: pre标签被两层div嵌套，代码冗余 pre标签内被硬植入字族的inline stylesheet，覆盖了我的CSS设置 插件自带的CSS文件重置了我的CSS设置 自动转义&#60;, &#62;, &#38;这类代码，问题是稍有经验的coder都会事先自己主动转义过的，所以之前已经转义过了的代码反而会以&#38;lt;, &#38;gt;, &#38;amp;这类形式输出 首先改造代码嵌套的问题 找到插件目录下的wp-syntax.php文件，搜索wp_syntax_highlight函数，将以下几行注释掉(注释行前加了//符号): function wp_syntax_highlight($match) { global $wp_syntax_matches; ...... if ($escaped != "false") $code = htmlspecialchars_decode($code); $geshi = new GeSHi($code, $language); $geshi-&#62;enable_keyword_links(false); do_action_ref_array('wp_syntax_init_geshi', array(&#38;$geshi)); //$output = "\n&#60;div class=\"wp_syntax\"&#62;"; if ($line) { ...... } else { //$output .= "&#60;div class=\"code\"&#62;"; $output .= $geshi-&#62;parse_code(); //$output .= [...]]]></description>
			<content:encoded><![CDATA[<p>经常要往blog里贴代码，没个代码高亮实在有点落伍。找来找去，wordpress下也就<a href="http://wordpress.org/extend/plugins/wp-syntax/" title="WP-Syntax">WP-Syntax</a>最好用了，支持的语言也比较多，像linux下的bash, vim都可以被高亮化。不过WP-Syntax也并非完美，有些地方和我的使用习惯相差甚远:</p>
<p>先来看下改造前和改造后的代码吧:</p>
<p><img src="http://pic.yupoo.com/punkid/567887392b25/pelo4o3u.jpg" alt="wp-syntax" width="500" height="371" border="0" /><br />
<span id="more-309"></span></p>
<ol>
<li><code>pre</code>标签被两层<code>div</code>嵌套，代码冗余</li>
<li><code>pre</code>标签内被硬植入字族的<code>inline stylesheet</code>，覆盖了我的CSS设置</li>
<li>插件自带的CSS文件重置了我的CSS设置</li>
<li>自动转义<code>&lt;</code>, <code>&gt;</code>, <code>&amp;</code>这类代码，问题是稍有经验的coder都会事先自己主动转义过的，所以之前已经转义过了的代码反而会以<code>&amp;lt;</code>, <code>&amp;gt;</code>, <code>&amp;amp;</code>这类形式输出</li>
</ol>
<h3>首先改造代码嵌套的问题</h3>
<p>找到插件目录下的<code>wp-syntax.php</code>文件，搜索<code>wp_syntax_highlight</code>函数，将以下几行注释掉(注释行前加了<code>//</code>符号):</p>
<pre lang="php">
function wp_syntax_highlight($match)
{
    global $wp_syntax_matches;
    ......
    if ($escaped != "false") $code = htmlspecialchars_decode($code);

    $geshi = new GeSHi($code, $language);
    $geshi-&gt;enable_keyword_links(false);
    do_action_ref_array('wp_syntax_init_geshi', array(&amp;$geshi));

    //$output = "\n&lt;div class=\"wp_syntax\"&gt;";

    if ($line)
    {
    ......
    }
    else
    {
	//$output .= "&lt;div class=\"code\"&gt;";
        $output .= $geshi-&gt;parse_code();
	//$output .= "&lt;/div&gt;";
    }
	//return

	//$output .= "&lt;/div&gt;\n";

    return $output;
}
</pre>
<h3>转义问题</h3>
<p>还是<code>wp_syntax_highlight</code>函数，将这句:</p>
<pre lang="php">if ($escaped == "true") $code = htmlspecialchars_decode($code);</pre>
<p>替换成</p>
<pre lang="php">if ($escaped != "false") $code = htmlspecialchars_decode($code);</pre>
<p>就是了，也就是说除非手动在<code>&lt;pre&gt;</code>里加入<code>escaped="false"</code>参数，输出的代码是不会自动转义的。</p>
<h3>硬植入CSS问题</h3>
<p>由于WP-Syntax可以方便的调用<code>wp_syntax_init_geshi</code>来修改geshi的初始设置，解决CSS问题可以不需要修改WP-Syntax本身的插件代码，全部在主题文件夹下的<code>functions.php</code>里就可以搞定了。</p>
<p>首先解决往<code>pre</code>里插入字族设置的问题，在<code>functions.php</code>里加入一函数:</p>
<pre lang="php">
function my_custom_geshi_styles(&amp;$geshi) {
    $geshi-&gt;set_overall_style('');
    $geshi-&gt;set_code_style('');
};
</pre>
<p>它会把geshi预设的inline stylesheet全部清除为空，然后再利用Wordpress的<a href="http://codex.wordpress.org/Function_Reference/add_action" title="Function Reference/add action">add_action</a> hook重新初始化geshi的设置，在<code>functions.php</code>里加入这句:</p>
<pre lang="php">
add_action('wp_syntax_init_geshi', 'my_custom_geshi_styles');
</pre>
<p>至于去掉WP-Syntax自带的CSS文件就更简单了，还是往<code>functions.php</code>里添加一句<a href="http://codex.wordpress.org/Function_Reference/remove_action" title="Function Reference/remove action">remove_action</a>的hook就是了:</p>
<pre lang="php">
remove_action('wp_head', 'wp_syntax_head');
</pre>
<p>其实<a href="http://wordpress.org/extend/plugins/wp-pagenavi/" title="WP-PageNavi">WP-PageNavi</a>带的那两三行代码的CSS文件也可以这么干掉:</p>
<pre lang="php">
remove_action('wp_head', 'pagenavi_css');
</pre>
<h3>小结</h3>
<p>其实Wordpress主题文件夹下的<code>functions.php</code>文件是相当有用的，利用Wordpress本身提供的<a href="http://codex.wordpress.org/Plugin_API" title="Wordpress Codex: Plugin API">Plugin API</a>, 很多东西都可以直接在<code>functions.php</code>下直接用一个函数挂上action或者filter的钩子就搞定了。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2009/04/03/wp-syntax-improvement/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Tips in Aggregate</title>
		<link>http://blog.punkid.org/2008/05/26/tips-in-aggregate/</link>
		<comments>http://blog.punkid.org/2008/05/26/tips-in-aggregate/#comments</comments>
		<pubDate>Mon, 26 May 2008 15:53:56 +0000</pubDate>
		<dc:creator>iPUNKID</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=216</guid>
		<description><![CDATA[都是些很零碎的tips，涉及到linux, wordpress, css, php, English &#8230; 选择性阅读吧! Douban and PHP 按照之前QQ签名秀的原理把豆瓣的个人广播系统也给提取出来了，效果请见此test页面。 使用方法是把以下代码添加到你的页面里: &#60;script type="text/javascript" src="http://punkid.org/glade/douban/request.php?userid=username&#38;numbers=5"&#62;&#60;/script&#62; 其中userid后面跟的是你的豆瓣用户名，numbers后面是显示条目数(最多10条)。至于怎么polish这个douban的miniblog纯粹是你的CSS活。对了，输出编码是UTF-8。 PHP tips: 用addslashes这个函数可以对字符串进行转义。 Linux 1. Tired of emerging the world? emerge $(eix -Iuc --format-compact "&#60;category&#62;/&#60;name&#62;" dev-libs/* &#124; head -n -1) 可以用来更新某一category(例如dev-libs)下的已安装软件。 2. Ape转mp3 emerge shntools 和 mac-port (gentoo-china overlay提供) 后运行: shnsplit -f filename.cue -t "%n - %t" -o "cust [...]]]></description>
			<content:encoded><![CDATA[<p>都是些很零碎的tips，涉及到linux, wordpress, css, php, English &#8230; 选择性阅读吧!</p>
<h3>Douban and PHP</h3>
<p>按照之前<a href="http://punkid.org/qqsign/" title="QQ签名秀">QQ签名秀</a>的原理把豆瓣的个人广播系统也给提取出来了，效果请见此<a href="http://punkid.org/glade/douban/test.html" title="Douban miniblog test page">test页面</a>。</p>
<p>使用方法是把以下代码添加到你的页面里:</p>
<pre lang="xml">
&lt;script type="text/javascript" src="http://punkid.org/glade/douban/request.php?userid=<strong>username</strong>&amp;numbers=5"&gt;&lt;/script&gt;
</pre>
<p>其中<code>userid</code>后面跟的是你的豆瓣用户名，<code>numbers</code>后面是显示条目数(最多10条)。至于怎么polish这个douban的miniblog纯粹是你的CSS活。对了，输出编码是UTF-8。</p>
<p>PHP tips: 用<a href="http://cn.php.net/manual/en/function.addslashes.php" title="PHP:addslashes">addslashes</a>这个函数可以对字符串进行转义。<br />
<span id="more-216"></span></p>
<h3>Linux</h3>
<h4>1. Tired of emerging the world?</h4>
<pre lang="bash">
emerge $(eix -Iuc --format-compact "&lt;category&gt;/&lt;name&gt;" dev-libs/* | head -n -1)
</pre>
<p>可以用来更新某一category(例如dev-libs)下的已安装软件。</p>
<h4>2. Ape转mp3</h4>
<p>emerge shntools 和 mac-port (<a href="http://code.google.com/p/gentoo-china-overlay/" title="Gentoo China Overlay">gentoo-china overlay</a>提供) 后运行:</p>
<pre lang="bash">
shnsplit -f filename.cue -t "%n - %t" -o "cust ext=mp3 lame --preset extreme - %f" filename.ape
</pre>
<p>会根据cue文件对ape进行切割成按<code>tracknumber - trackname</code>命名的mp3文件，不过ID3信息没法保存进去，交给<a href="http://www.musicbrainz.org/" title="Musicbrainz">Musicbrainz</a>搞定吧。</p>
<h4>3. 使用Aria2下载器</h4>
<p>原来用的axel不知何故在我的电脑上经常出现Initialing download就停滞不前的情况，无奈&#8230;换了个稍微大点的Aria2。顺便把Gentoo Mirror的默认下载也换成了aria2。更改make.conf如下:</p>
<pre lang="bash">
FETCHCOMMAND="/usr/bin/aria2c -c -s 4 -d ${DISTDIR} -o ${FILE} ${URI}"
RESUMECOMMAND="${FETCHCOMMAND}"
</pre>
<p>至于在firefox里用flashgot启用aria2下载，在<code>Executable path</code>里填<code>/usr/bin/rxvt</code> (任意虚拟终端，别用xterm就是了，那个启动太慢了)，然后在<code>Command line arguments template</code>里填<code>-e aria2c -s 5 -d [FOLDER] [URL]</code></p>
<h3>WordPress</h3>
<h4>1. 只显示当日评论数</h4>
<p>不明白我的意思的，留个言在到首页看下就知道了，当日有留言的日志会格外用类似于<em>3 comments today</em>方式显示。方法很简单，抽数据而已。修改你的模板的index.php，再最顶端添加:</p>
<pre lang="php">
&lt;?php
	$nowtime = current_time('timestamp');
	$today = date('Y-m-d G:i:s', mktime(0, 0, 0, date('m',$nowtime), date('d',$nowtime), date('Y',$nowtime)));
?&gt;
</pre>
<p>然后是修改loop部分:</p>
<pre lang="xml">
&lt;?php if (have_posts()) : ?&gt;
	&lt;?php while (have_posts()) : the_post(); ?&gt;

		<strong>&lt;?php $today_comments = $wpdb-&gt;get_var("SELECT COUNT(*) FROM $wpdb-&gt;comments WHERE comment_post_ID = $id AND comment_date &gt;= '$today' AND comment_approved = '1'"); ?&gt;</strong>
		&lt;div class="entry"
		&lt;h2 id="post-&lt;?php the_ID(); ?&gt;" class="entrytitle"&gt;&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark" title="Permanent Link to &lt;?php the_title(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;
		&lt;p class="metadata clearfix"&gt;
		<strong>&lt;span class="cmt"&gt;&lt;?php if ($today_comments &gt; 0) { ?&gt;&lt;a class="todaycmt" href="&lt;?php the_permalink() ?&gt;#comments" title="Comment on &lt;?php the_title(); ?&gt;"&gt;&lt;?php echo $today_comments; ?&gt; Comment&lt;?php if ($today_comments&gt;1) echo 's'; ?&gt; Today&lt;/a&gt;&lt;?php } else { ?&gt;&lt;?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?&gt;&lt;?php } ?&gt;&lt;/span&gt;</strong>
		&lt;/p&gt;
		...
		&lt;/div&gt;

		&lt;?php } ?&gt;

		...

&lt;?php endif; ?&gt;
</pre>
<p>加重部分是关键。</p>
<h4>2. 过滤某category的feed输出</h4>
<p>在模板的function.php里添加这段代码:</p>
<pre lang="php">
&lt;?php
function RssFilter($query) {
     if ($query-&gt;is_feed) {
         $query-&gt;set('cat','-<strong>22</strong>');
     }
         return $query;
}

add_filter('pre_get_posts','RssFilter');
?&gt;
</pre>
<p>其中22为你的category ID。</p>
<h3>CSS</h3>
<p>CSS的代码书写风格我倾向于单行式，用缩进表明元素的从属关系。例如:</p>
<pre lang="css">
#secondary div.modules {margin-bottom:40px;}
	#secondary div.modules a {color:#888;}
	#secondary div.modules a:hover {color:#FF32B3;text-decoration:underline;}
	#secondary div.modules h3 {color:#94C742;border-bottom:1px dotted #94C742;}
	#secondary div.modules ul li {padding:3px 8px;border-bottom:1px dashed #FF80D0;}
	#secondary div.modules ul li:hover {background:#F0F8E2;}

#bottom_wrapper h3 {color:#FDF262;border-bottom:1px solid #FDF262;}
	#bottom_wrapper div.modules {width:300px;margin:0 10px;float:left;position:relative;display:inline;}
	#bottom_wrapper div.modules ul li {height:1.6em;padding:3px 2px;border-bottom:1px dotted #528F08;overflow:hidden;}
	#bottom_wrapper div.modules ul li:hover {background:#528F08;}
	#bottom_wrapper div#misc table.calendar {width:300px;margin-bottom:20px;border-collapse:separate;border-spacing:1px;}
		table.calendar td {padding:3px 0 2px;text-align:center;}
		table.calendar td.calendar_h {display:none;}
		table.calendar td.today {background:#528F08;}
		table.calendar td.week {background:#528F08;color:#FDF262;}
	#bottom_wrapper div#tags ul li {margin-right:5px;padding:0;display:inline;border:0;}
		#bottom_wrapper div#tags ul li span, #bottom_wrapper div#tags div {display:none;}
</pre>
<p>也许这种单行的方式不利于阅读，但是类似block的书写方式最大的问题是一旦CSS代码上个几百行的，要找到某一行翻页是件很痛苦的事，而单行定义加上适当的缩进即便不看HTML源代码也能对页面结构有个基本的认识。还有就是&#8230;在VIM下用<code>w</code>,<code>b</code>进行整词跳跃是件很惬意的事，即便是单行也能很快的跳跃到需要修改查看的property。</p>
<h3>English</h3>
<h4>1. take with a pinch of salt</h4>
<p>Radiohead的<em>A Wolf at the Door</em>里有句歌词是<em>Take it with the love its given, take it with a pinch of salt, take it to the taxman</em>。</p>
<p>那<em>take it with a pinch of salt</em>真的是抓把盐吗? 真实的意思有点类似于姑且相信，半信半疑的意思，例如<em>Regarding what you said yesterday, I would take it with a pinch of salt</em>意思就是你昨天说的那些我姑且相信吧。</p>
<h4>Tia Dalma and I go way back</h4>
<p>在电影<em>Pirates of the Carribean : The Man&#8217;s Chest</em> (加勒比海盗2:聚魂棺)，Jack船长带着众人去找女巫Tia Dalma时说: <em>No worries, mates. Tia Dalma and I go way back.</em>。我记得当时我看的思路的版本翻译成了<em>伙计们，别担心，Tia Dalma和我待会就回来</em>。这其实是错误的，<em>go back way</em>的意思是表示两人认识很久了，交情很好。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2008/05/26/tips-in-aggregate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upgrade to WP2.3</title>
		<link>http://blog.punkid.org/2007/11/01/upgrade-to-wp23/</link>
		<comments>http://blog.punkid.org/2007/11/01/upgrade-to-wp23/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 16:09:32 +0000</pubDate>
		<dc:creator>iPUNKID</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tag]]></category>
		<category><![CDATA[the_tags]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/2007/11/01/upgrade-to-wp23/</guid>
		<description><![CDATA[在本机上调试了一个星期后，终于把WP升级到了2.3。因为native tag support的原因，不得不放弃了UTW这个超级好用的插件，我拿UTW做得一些SEO工作也得全部作废了。反正我就是不喜欢Wordpress的越来越华而不实，从2.1开始就没干过正经事儿了，反而让我越发不满意wordpress的运行效率。抱怨归抱怨，以下是调试WP2.3中碰到的一些问题，主要是和模板相关的。 糟糕的Tag体验 WP提供了原生的tag支持，不过这个the_tags()函数实在是有够弱的，一是它必须是strictly in the loop，而我的模板single page里的metadata都是显示在sidebar中的，the_category()，the_time()都能工作的很好，就the_tags()显示为空。我又不想把tag放到日志的loop里，最后只能在sidebar里做个rewind操作了，代码如下: &#60;?php if(is_single()) { ?&#62; &#60;?php rewind_posts(); ?&#62; &#60;?php while(have_posts()): the_post(); ?&#62; &#60;h2 id=&#34;metadata&#34;&#62;Metadata&#60;/h2&#62; &#60;dl&#62; &#60;dt&#62;Metadata&#60;/dt&#62; &#60;dd class=&#34;date&#34; title=&#34;postdate&#34;&#62;&#60;?php the_time(&#39;Y.n.j&#39;) ?&#62; / &#60;?php the_time(&#39;ga&#39;) ?&#62;&#60;/dd&#62; &#60;dd class=&#34;category&#34; title=&#34;category&#34;&#62;&#60;?php the_category(&#39;, &#39;) ?&#62;&#60;/dd&#62; &#60;dd class=&#34;tag&#34; title=&#34;tag&#34;&#62;&#60;?php the_tags(&#39;&#39;,&#39;, &#39;,&#39;&#39;) ?&#62;&#60;/dd&#62; &#60;?php endwhile; ?&#62; &#60;?php } ?&#62; 原本在UTW下，对于没有tag的日志可以指定相应的tag替代文字，例如&#8221;No Tag&#8221;，但是在WP里，the_tags()弱到没有tag也输出个null值来。我自然是希望在没有赋予日志tag的情况下，tag栏里显示&#8221;No Tag&#8221;信息啦。看了下wordpress wp-includes目录下的category-template.php文件里get_the_tags()函数，其中有这么一段: [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://photo11.yupoo.com/20071031/232053_317822381_nwbqasvs.jpg" alt="wordpress" width="145" height="144" border="0" class="floatleft" />在本机上调试了一个星期后，终于把WP升级到了2.3。因为native tag support的原因，不得不放弃了UTW这个超级好用的插件，我拿UTW做得一些SEO工作也得全部作废了。反正我就是不喜欢Wordpress的越来越华而不实，从2.1开始就没干过正经事儿了，反而让我越发不满意wordpress的运行效率。抱怨归抱怨，以下是调试WP2.3中碰到的一些问题，主要是和模板相关的。</p>
<h3>糟糕的Tag体验</h3>
<p>WP提供了原生的tag支持，不过这个<code>the_tags()</code>函数实在是有够弱的，一是它必须是strictly in the loop，而我的模板single page里的metadata都是显示在sidebar中的，<code>the_category()</code>，<code>the_time()</code>都能工作的很好，就<code>the_tags()</code>显示为空。我又不想把tag放到日志的loop里，最后只能在sidebar里做个rewind操作了，代码如下:<br />
<span id="more-160"></span></p>
<pre>
&lt;?php if(is_single()) { ?&gt;
&lt;?php rewind_posts(); ?&gt;
&lt;?php while(have_posts()): the_post(); ?&gt;
&lt;h2 id=&quot;metadata&quot;&gt;Metadata&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;Metadata&lt;/dt&gt;
&lt;dd class=&quot;date&quot; title=&quot;postdate&quot;&gt;&lt;?php the_time(&#39;Y.n.j&#39;) ?&gt; / &lt;?php the_time(&#39;ga&#39;) ?&gt;&lt;/dd&gt;
&lt;dd class=&quot;category&quot; title=&quot;category&quot;&gt;&lt;?php the_category(&#39;, &#39;) ?&gt;&lt;/dd&gt;
&lt;dd class=&quot;tag&quot; title=&quot;tag&quot;&gt;&lt;?php the_tags(&#39;&#39;,&#39;, &#39;,&#39;&#39;) ?&gt;&lt;/dd&gt;
&lt;?php endwhile; ?&gt;
&lt;?php } ?&gt;
</pre>
<p>原本在UTW下，对于没有tag的日志可以指定相应的tag替代文字，例如&#8221;No Tag&#8221;，但是在WP里，<code>the_tags()</code>弱到没有tag也输出个null值来。我自然是希望在没有赋予日志tag的情况下，tag栏里显示&#8221;No Tag&#8221;信息啦。看了下wordpress wp-includes目录下的category-template.php文件里<code>get_the_tags()</code>函数，其中有这么一段:</p>
<pre lang="php">
if ( empty( $tags ) )
	return false;
return $tags;
</pre>
<p><code>get_the_tags()</code>函数在没有找到tag的情况下会返回为false值。我把<code>the_tags()</code>的调用改成了以下这句，这样就能在没有tag的情况下显示&#8221;No Tag&#8221;了:</p>
<pre>
&lt;?php if(!(get_the_tags())) echo &#39;No Tag&#39;; else the_tags(&#39;&#39;,&#39;, &#39;,&#39;&#39;); ?&gt;
</pre>
<h3>删除UTW</h3>
<p>用WP2.3导入了UTW的tag之后，就可以把UTW彻底移出了，UTW在数据库里添加了<em>wp_post2tag</em>, <em>wp_tag_synonyms</em>,<em> wp_tags</em> 这三个表，在mysql里用以下命令直接删除吧(建议先备份数据库):</p>
<pre lang="sql">
mysql&gt; DROP TABLE wp_post2tag,wp_tag_synonyms,wp_tags;
</pre>
<h3>插件相关</h3>
<p>不喜欢<a href="http://lesterchan.net/portfolio/programming.php" title="WP-PageNavi">WP-PageNavi</a>新版自作多情添加CSS样式文件，我的CSS文件都是用gzip压缩过的了，再说我更愿意自己定义WP-PageNavi的样式。编辑pagenavi.php文件，注释掉以下这段就是了:</p>
<pre>
### Function: Page Navigation CSS
#add_action(&#39;wp_head&#39;, &#39;pagenavi_css&#39;);
#function pagenavi_css() {
#       echo &quot;\n&quot;.&#39;&lt;!-- Start Of Script Generated By WP-PageNavi 2.20 --&gt;&#39;.&quot;\n&quot;;
#       echo &#39;&lt;link rel=&quot;stylesheet&quot; href=&quot;&#39;.get_option(&#39;siteurl&#39;).&#39;/wp-content/plugi
ns/pagenavi/pagenavi-css.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;&#39;.&quot;\n&quot;;
#       echo &#39;&lt;!-- End Of Script Generated By WP-PageNavi 2.20 --&gt;&#39;.&quot;\n&quot;;
#}
</pre>
<p><a href="http://orderedlist.com/wordpress-plugins/wp-tiger-administration/" title="Tiger Style Administration">Tiger Style Administration</a>是个很漂亮的WP后台主题，不过在2.3下显示似乎有点问题，最明显的就是footer位置偏了。我稍微修改了下它的css文件，喜欢这个插件的又想在2.3下正常使用的直接<a href='http://blog.punkid.org/wp-content/uploads/2007/11/tiger_style_administration_css.zip' title='Modified Tiger.css file for WP2.3 Compatibility'>下载我修改过的CSS文件</a>吧。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2007/11/01/upgrade-to-wp23/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress Theme: Lesbian L0ve</title>
		<link>http://blog.punkid.org/2007/03/10/wordpress-theme-lesbian-l0ve/</link>
		<comments>http://blog.punkid.org/2007/03/10/wordpress-theme-lesbian-l0ve/#comments</comments>
		<pubDate>Sat, 10 Mar 2007 04:20:51 +0000</pubDate>
		<dc:creator>iPUNKID</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[lesbian-l0ve]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/2007/03/10/wordpress-theme-lesbian-l0ve/</guid>
		<description><![CDATA[It wasnt meant to be a public released wordpress theme as I designed it just as a X&#8217;mas gift for someone.But now, it doesnt make any sense to me any more, something I really like shouldnt be kept in the closet, I decided to publish it. NOTES: The vector illustration I use as the background [...]]]></description>
			<content:encoded><![CDATA[<p>It wasnt meant to be a public released wordpress theme as I designed it just as a X&#8217;mas gift for someone.But now, it doesnt make any sense to me any more, something I really like shouldnt be kept in the closet, I decided to publish it. </p>
<p><img src="http://photo1.yupoo.com/20070310/110726_552704938_dmupokuo.jpg" alt="Lesbian love theme preview" width="339" height="376" border="0" /></p>
<p><strong>NOTES:</strong> The vector illustration I use as the background image is cropped from a wallpaper i found by chance. I couldnt find its author, and definitely the credits go to nobody but him/her. The original wallpaper is <a href="http://photo1.yupoo.com/20070310/114711_2008043587_ihmemcft.jpg" title="lesbian l0ve wallpaper">here</a>, help me find the author so i can give my thanx to him/her. And if there&#8217;s any copyright infringement problem, i&#8217;ll remove this theme asap.</p>
<h3>Theme Info</h3>
<ul>
<li>Theme Name: Lesbian L0ve</li>
<li><del datetime="2007-11-01T07:47:25+00:00">Theme Demo: <a href="http://playground.punkid.org/wp/index.php?wptheme=lesbian+l0ve" title="Run Demo">Here</a></del></li>
</ul>
<p><span id="more-28"></span></p>
<h3>Features</h3>
<ol>
<li><a href="automattic.com/code/widgets/" title="Wordpress Widgets">Sidebar Widgets</a> Supported</li>
<li>Compatible with WordPress 2.0+</li>
<li><a href="http://www.sonsofskadi.net/extended-live-archive/" title="ELA">ELA</a>,<a href="http://www.neato.co.nz/ultimate-tag-warrior/" title="UTW">UTW</a>,<a href="http://www.lesterchan.net/portfolio/programming.php" title="WP-PageNavi">WP-PageNavi</a> plugins supported, and dont worry that it&#8217;ll screw up your blog even you dont have these plugins installed/enabled</li>
<li><abbr title="Extensible HyperText Markup Language">XHTML</abbr> and <abbr title="Cascading Style Sheets">CSS</abbr> valid</li>
<li>Compatible with IE6+,Firefox,Opera,Konqueror&#8230;</li>
</ol>
<h3>Download</h3>
<ul>
<li><a href="http://blog.punkid.org/wp-content/uploads/2007/03/lesbianl0ve.zip" title="lesbian l0ve wordpress theme download">lesbianl0ve.zip</a></li>
</ul>
<h3>Installation</h3>
<ol>
<li>Extract the compressed file</li>
<li>Put the directory into wp-content/themes</li>
<li>Active it in the dashboard</li>
</ol>
<h3>Bug Report</h3>
<ul>
<li>This is a quick work,so please let me know any bugs of it. And it&#8217;ll be more welcome if you also point out the solution.</li>
<li>Contact Me: punkid[DOT]online[AT]gmail[DOT]com</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2007/03/10/wordpress-theme-lesbian-l0ve/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

