<?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>やみろぐ。</title>
	<atom:link href="http://rinkaiten.com/feed" rel="self" type="application/rss+xml" />
	<link>http://rinkaiten.com</link>
	<description>日々の生活を気ままにつづった日記帳。</description>
	<lastBuildDate>Mon, 23 Jan 2012 15:32:35 +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>新年紅包不景氣，炸樓泄憤去</title>
		<link>http://rinkaiten.com/58.html</link>
		<comments>http://rinkaiten.com/58.html#comments</comments>
		<pubDate>Mon, 23 Jan 2012 15:32:35 +0000</pubDate>
		<dc:creator>小闇</dc:creator>
				<category><![CDATA[隨筆]]></category>
		<category><![CDATA[日常]]></category>
		<category><![CDATA[杯具]]></category>
		<category><![CDATA[魔法少女小圓]]></category>

		<guid isPermaLink="false">http://rinkaiten.com/?p=58</guid>
		<description><![CDATA[(Homura Combat: 最近迷上了小焰同人射擊遊戲) 每年的紅包都遞減200大元啊…3月看中的CD快沒錢買了…悲催了…幹嘛連我的耳機都壞掉了…又得拿錢買新的… 我還是考慮考上9級演奏級（鋼琴的）好了，賺多個錢供養自己這方面的需要= = 聽人家說有的能一個月賺一萬多…orz]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;"><a href="https://lh5.googleusercontent.com/-lzUcGqh_AX8/Tx16VNF_6EI/AAAAAAAAATY/w51Q2bAykH4/s1300/299.png"><img src="https://lh5.googleusercontent.com/-lzUcGqh_AX8/Tx16VNF_6EI/AAAAAAAAATY/w51Q2bAykH4/s935/299.png" alt="" /></a><br />
<span style="color: #888888;">(Homura Combat: 最近迷上了小焰同人射擊遊戲)</span></p>
<p>每年的紅包都遞減200大元啊…3月看中的CD快沒錢買了…悲催了…幹嘛連我的耳機都壞掉了…又得拿錢買新的…<br />
我還是考慮考上9級演奏級（鋼琴的）好了，賺多個錢供養自己這方面的需要= = 聽人家說有的能一個月賺一萬多…orz</p>
]]></content:encoded>
			<wfw:commentRss>http://rinkaiten.com/58.html/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>[介紹]魔法少女まどか☆マギカ TPS FEATURING 暁美ほむら</title>
		<link>http://rinkaiten.com/55.html</link>
		<comments>http://rinkaiten.com/55.html#comments</comments>
		<pubDate>Tue, 10 Jan 2012 11:05:05 +0000</pubDate>
		<dc:creator>小闇</dc:creator>
				<category><![CDATA[ACG]]></category>
		<category><![CDATA[魔法少女小圓]]></category>

		<guid isPermaLink="false">http://rinkaiten.com/?p=55</guid>
		<description><![CDATA[&#160; 上年的一月神番「魔法少女小圓」對於我來說好像還沒完結般。隔了幾個星期就會自動翻看blu-ray全集，就是為了小焰的五周輪回啊！那集真的看得眼珠都不會動了，除了被那種渴望拯救圓神的那種堅定精神外，跟各位魔女的打鬥場面也很令我深刻。她的戰鬥方式相信各位都應該很熟悉，主要都是利用大殺傷力武器和外掛停止時間的魔法對抗魔女。下至自製武器，上至偷竊自衛隊飛彈……在大完滿結局後一直都很想一嘗代入小焰的戰鬥世界盡殺魔女。早1-2個月前官方宣布將會研發PSP版並預定在今年3月發售。杯具，沒有PSP……┐(´д｀)┌ 幸好官方有在android平台推出了以小焰為主角的射擊遊戲「魔法少女まどか☆マギカ TPS FEATURING 暁美ほむら」，讓我們這些沒錢買PSP的傢伙也能玩一下嚐鮮版。 &#160; &#160; 這遊戲一共十關，分easy, nomal(normal?), hard三級，換言之玩家要玩30回。Hard mode中只要任何一關打出Rank A/S，主目錄中的Gallery就會送劇圖桌布，大圖高清無碼。 關卡一覽 「玫瑰園」的魔女 「零食」的魔女 「箱」的魔女 「銀」的魔女 「影」的魔女 「人魚」的魔女 「藝術家」的魔女 「班長」的魔女 「雀籠」的魔女 魔女之夜 上圖中央那個彩色的球體是使魔的攻擊，中彈的話當然會令HP減少，還會直接影響ranking。只中一發就已經沒有rank a啦… 小焰在遊戲能得到的武器有點少，只有六種。 武器 Spread劇中常用的火箭炮，面對一群使魔來襲時能一炮擊退。面對大使魔（比一般使魔難殺死）魔女也很有殺傷力。 Rapid機關槍。神一般的存在，只需按住發射按鈕不放就感受到秒殺的快感…最多能有900發子彈(只限於easy mode)，殺魔女綽綽有餘XD Wide不是軍武宅的我表示不知道這是什麼，不過它很適合近距離作戰，遠射的話是瞄不準的。 Laser子彈分配得最少的激光槍，每次到手也只有一兩發子彈，不過在緊急關頭用它倒也不錯。最適合殺大使魔。 Ring同火箭炮一樣適合擊倒洶湧而上的使魔，不過弱點是小焰不乖乖的站好瞄準對象根本來多少炮都沒用。 Nomal預設最基本的手槍。好處是有無限發子彈，壞處是打每一發子彈都要按一次發射按鈕，手酸啊。 除了武器，小焰可以在魔女的結界／射殺使魔／射殺魔女的途中得到以下物品： 輔助物品 悲歎之種：每用完一次靜止時間的魔法後，靈核都會變黑。有這個便能清除污穢。 魚：恢復HP 自製炸彈：最好在時間靜止的時候接近魔女然後丟過去 魔女之夜可以跑慢點不…為了近距離丟炸彈小焰陣亡了好幾次然後復活了好幾次再被突然狙擊的煩人使魔直接一擊爆HP了…我這是什麼渣技術啊…]]></description>
			<content:encoded><![CDATA[<div class="wp-caption aligncenter" style="width: 930px"><img style="border:0;margin-bottom:0;" src="https://lh3.googleusercontent.com/-jGcd-XBohec/TwvqNJ2r9BI/AAAAAAAAAMY/-zAOvUscORM/s920/284.png" /><p class="wp-caption-text">全ての魔女は、私一人で片付けるーー</p></div>
<p>&nbsp;</p>
<p>上年的一月神番「魔法少女小圓」對於我來說好像還沒完結般。隔了幾個星期就會自動翻看blu-ray全集，就是為了小焰的五周輪回啊！那集真的看得眼珠都不會動了，除了被那種渴望拯救圓神的那種堅定精神外，跟各位魔女的打鬥場面也很令我深刻。她的戰鬥方式相信各位都應該很熟悉，主要都是利用大殺傷力武器和<del>外掛</del>停止時間的魔法對抗魔女。下至自製武器，上至偷竊自衛隊飛彈……在大完滿結局後一直都很想一嘗代入小焰的戰鬥世界盡殺魔女。早1-2個月前官方宣布將會研發PSP版並預定在今年3月發售。杯具，沒有PSP……┐(´д｀)┌ 幸好官方有在android平台推出了以小焰為主角的射擊遊戲<a href="https://market.android.com/details?id=jp.co.fwinc.madomagihomuraTPS">「魔法少女まどか☆マギカ TPS FEATURING 暁美ほむら」</a>，讓我們這些沒錢買PSP的傢伙也能玩一下嚐鮮版。</p>
<p>&nbsp;</p>
<p><a href="http://tieba.baidu.com/p/1342071735"><img style="cursor:default;" class="aligncenter" src="https://lh6.googleusercontent.com/-kd1exvkEih0/Twv0XdD5NbI/AAAAAAAAAMw/_dsiaSAvr4Q/s800/285.png" /></a></p>
<p>&nbsp;</p>
<p>這遊戲一共十關，分easy, nomal(normal?), hard三級，換言之玩家要玩30回。Hard mode中只要任何一關打出Rank A/S，主目錄中的Gallery就會送劇圖桌布，大圖高清無碼。</p>
<h4>關卡一覽</h4>
<ol>
<li>「玫瑰園」的魔女</li>
<li>「零食」的魔女</li>
<li>「箱」的魔女</li>
<li>「銀」的魔女</li>
<li>「影」的魔女</li>
<li>「人魚」的魔女</li>
<li>「藝術家」的魔女</li>
<li>「班長」的魔女</li>
<li>「雀籠」的魔女</li>
<li>魔女之夜</li>
</ol>
<p><img class="aligncenter" src="https://lh3.googleusercontent.com/-5C4gFZ9jFF4/TwwD6eGREHI/AAAAAAAAANY/xRleDhqg3T0/s800/286.png" /><br />
上圖中央那個彩色的球體是使魔的攻擊，中彈的話當然會令HP減少，還會直接影響ranking。只中一發就已經沒有rank a啦…</p>
<p>小焰在遊戲能得到的武器有點少，只有六種。</p>
<h4>武器</h4>
<ul style="list-style-position:outside; !important;margin-left:20px;">
<li>Spread<br />劇中常用的火箭炮，面對一群使魔來襲時能一炮擊退。面對大使魔（比一般使魔難殺死）魔女也很有殺傷力。</li>
<li>Rapid<br />機關槍。神一般的存在，只需按住發射按鈕不放就感受到秒殺的快感…最多能有900發子彈(只限於easy mode)，殺魔女綽綽有餘XD</li>
<li>Wide<br />不是軍武宅的我表示不知道這是什麼，不過它很適合近距離作戰，遠射的話是瞄不準的。</li>
<li>Laser<br />子彈分配得最少的激光槍，每次到手也只有一兩發子彈，不過在緊急關頭用它倒也不錯。最適合殺大使魔。</li>
<li>Ring<br />同火箭炮一樣適合擊倒洶湧而上的使魔，不過弱點是小焰不乖乖的站好瞄準對象根本來多少炮都沒用。</li>
<li>Nomal<br />預設最基本的手槍。好處是有無限發子彈，壞處是打每一發子彈都要按一次發射按鈕，手酸啊。</li>
</ul>
<p>除了武器，小焰可以在魔女的結界／射殺使魔／射殺魔女的途中得到以下物品：</p>
<h4>輔助物品</h4>
<ul style="list-style-position:outside; !important;margin-left:20px;">
<li>悲歎之種：每用完一次靜止時間的魔法後，靈核都會變黑。有這個便能清除污穢。</li>
<li>魚：恢復HP</li>
<li>自製炸彈：最好在時間靜止的時候接近魔女然後丟過去</li>
</ul>
<p>魔女之夜可以跑慢點不…為了近距離丟炸彈小焰陣亡了好幾次然後復活了好幾次再被突然狙擊的煩人使魔直接一擊爆HP了…我這是什麼渣技術啊…</p>
]]></content:encoded>
			<wfw:commentRss>http://rinkaiten.com/55.html/feed</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>在functions.php增設博客自訂代碼</title>
		<link>http://rinkaiten.com/38.html</link>
		<comments>http://rinkaiten.com/38.html#comments</comments>
		<pubDate>Sat, 07 Jan 2012 14:45:41 +0000</pubDate>
		<dc:creator>小闇</dc:creator>
				<category><![CDATA[折騰]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://rinkaiten.com/?p=38</guid>
		<description><![CDATA[取出部份譯自WordPress のよくあるカスタマイズコード functions.php 多め &#8211; Webデザインレシピ。 素敵な記事を書いてくれて、ありがとうございました！ 大家都知道在functions.php除了可以自定義博客主題的功能外，其實對於博客系統－－Wordpress本身，多加利用functions.php也能自訂系統內部。 哎，我日文還不是很熟練，只能翻到看得懂的程度…有錯請提點一下。 全文中只有第二大點有關分享按鈕的沒翻譯，因為能取代的應用或插件實在是太多…我想未必一定要用functions.php加插分享按鈕。 全文的博客系統的項目名稱全部以台灣正體中文版為主。 這是一篇給自己寫Wordpress主題時，經常會用到的代碼的集大成。主要是展示很多在functions.php寫下的簡單代碼。我（指原作者，以下同）從事網頁製作，所以文章後半部分是一些面向客戶而折騰出來的代碼。 我經常用Evernote，可是也記下了很多有關Wordpress自訂代碼的文章，於是把亂七八糟的文章整理了一遍… X( 從中只整理了在一般會用到的代碼。代碼都是我個人經常會用到的，真想把它們整理在一個地方～這樣想著就寫下這篇備忘。全部皆在Wordpress 3.2版本開始測試成功。 在 WordPress 經常會有的自訂代碼：目錄 設定關連 摘錄表示、the_excerpt 關連 限制要顯示的標題文字數量 把特定的文字轉換成連結 在側欄的分類列表中加上圖標 顯示favicon 在搜尋結果中消除特定頁面 想把自訂欄位用在文章循環外 增加縮圖至RSS feed中的摘要發布 也為管理介面添加favicon 改變HTML編輯器的字型 讓文章能加插獨立CSS 面對客戶？的自訂方法 1. 設定關連 1.1. 改變可上傳檔案的大小 除非你有上傳圖片的需要，否則這個功能其實都不太重要。但如果你要在其他博客匯入文章時，檔案有可能會很大。 這個時候就需要修改上傳檔案的大小，不過這項功能並不是在Wordpress中修改，而是出於主機的設定。所以，一般的更改都會在php.ini進行。 ↑ 指這個。 php.ini 1 2 3 4 upload_max_filesize = 32M post_max_size = 64M /* 錯誤表示 [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>取出部份譯自<a href="http://webdesignrecipes.com/wordpress-customize-with-functions-php/">WordPress のよくあるカスタマイズコード functions.php 多め &#8211; Webデザインレシピ</a>。</p>
<p>素敵な記事を書いてくれて、ありがとうございました！</p></blockquote>
<p>大家都知道在functions.php除了可以自定義博客主題的功能外，其實對於博客系統－－Wordpress本身，多加利用functions.php也能自訂系統內部。<br />
<span style="color:#999"><br />
哎，我日文還不是很熟練，只能翻到看得懂的程度…有錯請提點一下。</p>
<p><strong>全文中只有第二大點有關分享按鈕的沒翻譯，因為能取代的應用或插件實在是太多…我想未必一定要用functions.php加插分享按鈕。</strong><br />
<strong>全文的博客系統的項目名稱全部以台灣正體中文版為主。</strong><br />
</span></p>
<hr />
<div id="start"></div>
<p><strong>這是一篇給自己寫Wordpress主題時，經常會用到的代碼的集大成。主要是展示很多在functions.php寫下的簡單代碼。我<strong>（指原作者，以下同）</strong>從事網頁製作，所以文章後半部分是一些面向客戶而折騰出來的代碼。</strong></p>
<p>我經常用Evernote，可是也記下了很多有關Wordpress自訂代碼的文章，於是把亂七八糟的文章整理了一遍… X( 從中只整理了在一般會用到的代碼。代碼都是我個人經常會用到的，真想把它們整理在一個地方～這樣想著就寫下這篇備忘。全部皆在Wordpress 3.2版本開始測試成功。</p>
<h2 id="top_index" style="color:#1982D1">在 WordPress 經常會有的自訂代碼：目錄</h2>
<ol>
<li><a href="#p1">設定關連</a></li>
<li><a href="#p2">摘錄表示、the_excerpt 關連</a></li>
<li><a href="#p3">限制要顯示的標題文字數量</a></li>
<li><a href="#p4">把特定的文字轉換成連結</a></li>
<li><a href="#p5">在側欄的分類列表中加上圖標</a></li>
<li><a href="#p6">顯示favicon</a></li>
<li><a href="#p7">在搜尋結果中消除特定頁面</a></li>
<li><a href="#p8">想把自訂欄位用在文章循環外</a></li>
<li><a href="#p9">增加縮圖至RSS feed中的摘要發布</a></li>
<li><a href="#p10">也為管理介面添加favicon</a></li>
<li><a href="#p11">改變HTML編輯器的字型</a></li>
<li><a href="#p12">讓文章能加插獨立CSS</a></li>
<li><a href="#p13">面對客戶？的自訂方法</a></li>
</ol>
<h2 id="p1">1. 設定關連</h2>
<h3>1.1. 改變可上傳檔案的大小</h3>
<p>除非你有上傳圖片的需要，否則這個功能其實都不太重要。但如果你要在其他博客匯入文章時，檔案有可能會很大。<br />
這個時候就需要修改上傳檔案的大小，不過這項功能<strong>並不是在Wordpress中修改，而是出於主機的設定</strong>。所以，一般的更改都會在<strong>php.ini</strong>進行。</p>
<p><img src="https://lh3.googleusercontent.com/-HvCIiA4ZTVY/TwSPXzMD8cI/AAAAAAAAADs/hcej5rKA0es/s578/266.png" /></p>
<p>↑ 指這個。</p>
<h4>php.ini</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="txt" style="font-family:monospace;">upload_max_filesize = 32M
post_max_size = 64M
/* 錯誤表示 */
display_errors = Off</pre></td></tr></table></div>

<p>更改的部份是在<strong>upload_max_filesize</strong>。如果無任何更改的話，應該會有8M限制吧？也拿<strong>post_max_size</strong>一塊兒檢查吧，不管你如何更改upload_max_filesize，如果post_max_size的數值比它小的話就會悲劇了…。</p>
<p>我經常直接在php.ini中折騰，不過有部份的可能並不允許直接編輯。其實也是有辦法用.htaccess寫成的，請看下面（雖然有被提醒了不過其實我還沒幹過這種事所以就當成參考吧）。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="htaccess" style="font-family:monospace;">php_value upload_max_filesize 32M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300</pre></td></tr></table></div>

<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>1.2. 禁止自我引用文章</h3>
<p>在Wordpress中，如果在文章中插入了他人博客的連結，就會自動發送引用給該博主(trackback)。可是，如果在文章中貼上自己過去文章的連結，也一樣會收到通告(pingback)。應該有很多人覺得這個蠻討厭的吧。<br />
因此，我們要禁止自我引用文章。於functions.php加插以下內容：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> no_self_ping<span style="color: #009900;">&#40;</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$links</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$home</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'home'</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;">$links</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$l</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$link</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">===</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$link</span><span style="color: #339933;">,</span> <span style="color: #000088;">$home</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
            <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$links</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$l</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'pre_ping'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'no_self_ping'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<ul>
<li>via：<a href="http://www.allwebmaster.com/2011/06/wordpress-tip-disable-self-pingbacks/">WordPress Tip : Disable Self Pinbacks</a></li>
</ul>
<p>以及，在<strong>設定 → 討論</strong>一處也可以禁用這個功能。</p>
<p><img src="https://lh3.googleusercontent.com/-rdxuBo4SEcs/TwSeUp_orxI/AAAAAAAAAEE/z5yxw-B9SVI/s468/267.png" /></p>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>1.3. 主題功能</h3>
<p>在Wordpress，預設有幾種主題功能，不過也有一些是被隱藏了的。如果想啟動它們的話就要在functions.php加插以下代碼。</p>
<h4>運用縮略圖</h4>
<p>於編輯版面加插縮點圖。</p>
<p><img src="https://lh3.googleusercontent.com/-xeW8YFJdAAM/TwSjVzCLsUI/AAAAAAAAAEc/TXJVRI6y_rg/s830/268.png" /></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_theme_support<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'post-thumbnails'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>如果想輸出至index.php或其它地方的話，就要像以下的這般寫：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_post_thumbnail<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></div></div>

<h4>運用文章摘要</h4>
<p>在固定頁面預設不能使用文章摘要，可是還是有辦法開啟這個功能。<br />
<img src="https://lh6.googleusercontent.com/-vfBCrNxTi00/TwSswzoOIhI/AAAAAAAAAE0/HZvUkknoBwQ/s460/269.png" /></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_post_type_support<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'page'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'excerpt'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>於index.php等等地方輸出：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_excerpt<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></div></div>

<h4>自訂導航列</h4>
<p><img src="https://lh5.googleusercontent.com/-LsiRugLyUuc/TwStrjcy4cI/AAAAAAAAAFM/faLfXFpnM-c/s230/270.png" /><br />
這是Wordpress3.1版本時推出的新功能，如有需要啟用請於functions.php加插：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_theme_support<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'menus'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>如果想在header.php或其他部份輸出導航欄：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_nav_menu<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></div></div>

<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h2 id="p2">2. 摘錄表示、the_excerpt 關連</h2>
<p>在Wordpress的編輯文章畫面裡，按一下more按鈕就會在文章插入<!-more->。這樣的話在首頁或其他地方就不會顯示全文而會在中間顯示「繼續閱讀全文」。不過我經常都會忘記了這個步驟，所以我會在首頁文章等等的地方使用the_excerpt、文章摘要。<br />
<img src="https://lh6.googleusercontent.com/-5JsCJkUKcy4/TwXSjY-32nI/AAAAAAAAAGA/DsHnPiuGMmo/s740/271.png" alt="" /></p>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>2.1. 讓the_excerpt中的[...]字樣變成其他字</h3>
<p>當你在文章摘要打了字之後，文末會帶有[...]字樣。如果不喜歡的話，可以加以刪除。在functions.php加插以下代碼:</p>
<h4>functions.php</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> new_excerpt_more<span style="color: #009900;">&#40;</span><span style="color: #000088;">$more</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'excerpt_more'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'new_excerpt_more'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>第二行的return "; 中間打&#8217;…&#8217;的話，文末就會變成「…」而不是[...]了。</p>
<h3>2.2. 在文章摘要末端加上繼續閱讀全文連結</h3>
<p><img src="https://lh4.googleusercontent.com/-uaqLV31mk24/TwXSjIoaCNI/AAAAAAAAAF8/2jzVUy6U9vI/s740/272.png" alt="" /><br />
想加入the_excerpt函數中「繼續閱讀」的連結，請加插以下代碼到functions.php。其實說白了這只是剛才介紹的代碼的改良版而已。</p>
<h4>functions.php</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> new_excerpt_more<span style="color: #009900;">&#40;</span><span style="color: #000088;">$more</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">' ... &lt;a class=&quot;more&quot; href=&quot;'</span><span style="color: #339933;">.</span> get_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;繼續閱讀全文&lt;/a&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'excerpt_more'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'new_excerpt_more'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>2.3. 限制摘要的文字數量</h3>
<p>有時候也會想改改摘要文字的數量，其實在WordPress Codex裡就有介紹如何變更the_excerpt輸出的文字數量。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> new_excerpt_length<span style="color: #009900;">&#40;</span><span style="color: #000088;">$length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 文字數量 */</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'excerpt_length'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'new_excerpt_length'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>不過使用Wordpress日本版時，系統包裡定必會有一個叫<strong>WP Multibyte Patch</strong>的插件是吧？可是因為它限制著摘要數目維持在110字之內，所以上面的代碼就沒效果了……</p>
<p>於是只需加插以下的代碼，就可以隨心的選你喜歡輸出的文字數量。利用mb_substr函數，把文字截斷就行了吧。</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">mb_substr</span><span style="color: #009900;">&#40;</span>get_the_excerpt<span style="color: #009900;">&#40;</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;">30</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<ul>
<li>via：<a href="http://cook-le.com/wp_blog/406.html">WordPressタグ　the_excerpt() の文字数を制御</a></li>
</ul>
<p>原來如此－－這樣就能選擇喜歡的字數呢！試著上面的提示折騰了一段代碼出來了：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/* 文字摘要替代版 */</span>
<span style="color: #000000; font-weight: bold;">function</span> my_excerpt<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$length</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;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mb_substr</span><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: #000088;">$length</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$content</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;...&quot;</span><span style="color: #339933;">;</span>
     <span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>想要在博客輸出文章摘要，只需照以下寫的指定（數字）就可以了。像下面寫的就會限制至40字！</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> my_excerpt（<span style="color: #cc66cc;">40</span>）<span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h2 id="p3">3. 限制要顯示的標題文字數量</h2>
<p>從哪一方面來說，我的博客文章標題其實也太長了吧XD 在單一記事頁面(single.php)裡，固然是可以完全顯示文章標題，不過在首頁之類的地方看的話，有可能會因為標題太長而導致版面崩潰這種囧事。<br />
當然利用css是可以有一定程度的限制，不過如果在標題過長的時候，省略它也許會是個好辦法。</p>
<p><img src="https://lh3.googleusercontent.com/-ZCSUShHbaGU/TwXzeRVUxAI/AAAAAAAAAGc/Sg97BtafqZ4/s514/273.png" alt="" /></p>
<h4>functions.php</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> titlelimitchar<span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</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: #990000;">mb_strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">20</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</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: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>is_page<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: #009900;">&#123;</span>
    <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mb_substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;...&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'the_title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'titlelimitchar'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>在上面的例子可以看到，利用mb_substr($title,0,20)能把字數限制至20字。不過有時候標題裡會夾雜全形和半形，那時文字數量也會隨著同一個長度變更，這點要注意喔！</p>
<ul>
<li>via：<a href="http://www.dynamicwp.net/articles-and-tutorials/how-to-limit-character-in-the-post-title/">How to Limit Character in The Post Title</a></li>
</ul>
<blockquote><p>（其實看真一點第二、三大點跟winy寫的那個原理差不多，不過他那個更是三合一的，也可以去掉html碼保持整潔。詳細：<a href="http://winysky.com/automatically-truncated-to-share-some-code-wordpress">分享一段wordpress自动截断代码</a>）</p></blockquote>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h2 id="p4">4. 把特定的文字轉換成連結</h2>
<p>在寫博文時，如果有經常插入的連結（例如是自己的twitter頁面的連結），每次都要逐個字輸入實在很麻煩。所以如果能把特定的文字自動換成指定的連結那就方便多了！我比較懶惰，就把以下的代碼寫進functions.php裡。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/* 替換文字成連結 */</span>
<span style="color: #000000; font-weight: bold;">function</span> replace_text_wps<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;">$replace</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'@twitter'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;a href=&quot;http://twitter.com/WebDesignRecipe&quot; target=&quot;_blank&quot; class=&quot;twitter-link&quot;&gt;@WebDesignRecipe&lt;/a&gt;'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'@facebook'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;a href=&quot;http://www.facebook.com/nori.takahashi&quot; target=&quot;_blank&quot; class=&quot;facebook-link&quot;&gt;facebook 個人資料&lt;/a&gt;'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'@g-plus'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;a href=&quot;https://plus.google.com/116578177130489958038/about&quot; target=&quot;_blank&quot; class=&quot;g-plus-link&quot;&gt;Google+ 個人資料&lt;/a&gt;'</span><span style="color: #339933;">,</span>
  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array_keys</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$replace</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$text</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'replace_text_wps'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>在上例中，在文章中鍵入 <strong>@twitter</strong> 的話，就會輸出成 <a href="http://twitter.com/WebDesignRecipe">@WebDesignRecipe</a> 就是會把@WebDesignRecipe加上連結這樣。</p>
<p>（這個功能）只是單純的把文字自動換成連結，即使不是換成連結也可以，腦子裡有各種想法的話都可以用它來達成！</p>
<ul>
<li>via：<a href="http://www.wprecipes.com/how-to-easily-replace-words-in-your-posts">How to easily replace words in your posts</a></li>
</ul>
<p>同時，如果想省略代碼使其更有效率，在Wordpress有一預設功能很方便：<strong>短代碼</strong>！有關短代碼的介紹，請看<a href="http://webdesignrecipes.com/22-wordpress-customize-hack/">22個Wordpress客製化設定</a>。</p>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h2 id="p5">5. 在側欄的分類列表中加上圖標</h2>
<p>分類列表通常都會在側欄中表示。如果想在側欄中輸出分類列表，通常都會用到<strong>主題函數：wp_list_categories</strong>。</p>
<p>不過如果大家想在旁邊加上圖標的時候，大家又會怎樣折騰呢？利用wp_list_categories輸出的html碼就一定會是這樣：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cat-item cat-item-1&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Photo<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cat-item cat-item-2&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Design<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span></pre></td></tr></table></div>

<p>利用 <strong>cat-item-1</strong> 和 <strong>cat-item-2</strong>，的確能在CSS個別設定背景圖片。不過這樣設定有點煩人……。當在本地環境（注：例如XAMPP）製作主題時，由於主機分派的ID會應用在首頁、導航列、側欄各項目之類的地方，所以兩方的 cat-item-X（分類ID）未必會相同。有時候設定了 cat-item-1 顯示圖標A，可能最終會顯示圖標B。</p>
<p>如果可以話讓分類中的數字代碼變成英文代碼（像是 cat-photo 、又或者是cat-design），就一定會更好。<br />
所以想在旁邊加插圖標的話，就應該用 <strong>get_categories</strong> 而不是 wp_list_categories 。</p>
<h4>sidebar.php</h4>

<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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;ul&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$args</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
  <span style="color: #0000ff;">'orderby'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'name'</span><span style="color: #339933;">,</span>
  <span style="color: #0000ff;">'order'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'ASC'</span>
  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$categories</span><span style="color: #339933;">=</span>get_categories<span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</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;">$categories</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: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li class=&quot;cat-'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$category</span><span style="color: #339933;">-&gt;</span> <span style="color: #004000;">slug</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</span> <span style="color: #339933;">.</span> get_category_link<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">term_id</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; title=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;View all posts in <span style="color: #009933; font-weight: bold;">%s</span>&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; '</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/ul&gt;</pre></td></tr></table></div>

<p>這樣的話，就能把 cat-photo 、cat-design 之類的class屬性名稱替換成英文代碼了！不過一定要<strong>用英數字命名</strong>。不過究竟為什麼 wp_list_categories 不能替換class中的分類名稱呢…</p>
<h4>輸出的HTML碼</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cat-photo&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Photo<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cat-design&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Design<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span></pre></td></tr></table></div>

<ul>
<li>參考：WordPress CODEX <a href="http://codex.wordpress.org/Function_Reference/get_categories">Function Reference/get categories</a></li>
</ul>
<p>（注：本應原作者是參考自日本語版的wordpress codex，不過為了方便童鞋閱覽所以以上的連結換成本家英文版。）</p>
<blockquote><p>
追加</p>
<p><a href="http://www.warna.info/">Simple Colors</a> 童鞋成功折騰出<strong>在 wp_list_categories 也能把class中的分類名稱換成英文</strong>的代碼了！真的幫了我很多！感謝你啊！</p>
<p>詳情請看下面Simple Colors的教學喔！<br />
<a href="http://www.warna.info/archives/1489/">在wp_list_categories把class中的分類名稱換成英文</a>
</p></blockquote>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h2 id="p6">6. 顯示favicon</h2>
<p>雖然是可以直接寫進header.php裡，不過今次介紹的是先寫進functions.php然後鉤進(hook)header.php裡。「鉤」是什麼？有這樣疑惑的人請看看<a href="http://webdesignrecipes.com/wordpress-action-hook-and-filter-hook/">22のWordPressカスタマイズハック</a>這篇舊文吧！</p>
<h4>functions.php</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> blog_favicon<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;link rel=&quot;shortcut icon&quot; type=&quot;image/x-icon&quot; href=&quot;'</span><span style="color: #339933;">.</span>get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/images/favicon.ico&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: #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;">'blog_favicon'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h2 id="p7">7. 在搜尋結果中消除特定頁面</h2>
<p>有時並不想在搜尋頁面被搜到特定的文章。那樣只需加插以下代碼到functions.php就OK了。</p>
<h4>functions.php</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> fb_search_filter<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</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: #339933;">!</span><span style="color: #000088;">$query</span> <span style="color: #339933;">-&gt;</span> <span style="color: #004000;">is_admin</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$query</span> <span style="color: #339933;">-&gt;</span> <span style="color: #004000;">is_search</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$query</span> <span style="color: #339933;">-&gt;</span> <span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post__not_in'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">28</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">35</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;">return</span> <span style="color: #000088;">$query</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'pre_get_posts'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fb_search_filter'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>在 &#8216;post__not_in, array( 28, 35 ) 裡 ，指定那些不想被搜到的文章的ID就可以了。當然你可以增加其數量！</p>
<ul>
<li>via：<a href="http://wpengineer.com/2176/exclude-posts-and-pages-in-wordpress-search/">Exclude Posts and Pages in WordPress Search</a></li>
</ul>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h2 id="p8">8. 想把自訂欄位用在文章循環外</h2>
<p>自訂欄位，在Wordpress中其中一個很方便的功能。基本上，在自訂欄位裡輸入了的值可以在文章循環中取得。這東西是長這樣的：</p>
<h4>文章循環的樣子</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> have_posts<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: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<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>
&nbsp;
/*這就是循環*/
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>在index.php或single.php中應該會很常見。<br />
不過自訂欄位並沒有可以用在循環外的機制，所以有時也想在循環外用這個東西。那個時候，就請在想用的地方加插以下代碼到functions.php：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$postid</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span> <span style="color: #339933;">-&gt;</span> <span style="color: #004000;">post</span> <span style="color: #339933;">-&gt;</span> <span style="color: #004000;">ID</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$postid</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom-field-name'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
wp_reset_query<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>

<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h2 id="p9">9. 增加縮圖至RSS feed中的摘要發布</h2>
<p>在Wordpress的RSS/Atom feed發布頁面，可以選擇<strong>全文顯示</strong>或<strong>摘要顯示</strong>。這個博客"Web Design Recipes"正在使用摘要發布feed。</p>
<p>不過摘要發布時不能顯示文章縮點圖，這個有點遺憾…於是在functions.php加插了以下代碼。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$postid</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span> <span style="color: #339933;">-&gt;</span> <span style="color: #004000;">post</span> <span style="color: #339933;">-&gt;</span> <span style="color: #004000;">ID</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$postid</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom-field-name'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
wp_reset_query<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>這樣做的話，當你的文章有設定<strong>縮略</strong>圖時，RSS feed中的發布也會一併顯示。</p>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h2 id="p10">10. 也為管理介面添加favicon</h2>
<p>剛才介紹了改變博客favicon的方法，今回也想讓管理介面有所變更。不過不是同一款favicon喔！這樣可能會更易看懂吧！<br />
<img src="https://lh4.googleusercontent.com/-YOwWFg7mu_A/TwcfAj_yFXI/AAAAAAAAAHQ/e2KGhkLznqc/s532/274.png" /></p>
<h4>function.php</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> admin_favicon<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;link rel=&quot;shortcut icon&quot; type=&quot;image/x-icon&quot; href=&quot;'</span><span style="color: #339933;">.</span>get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/images/admin-favicon.icon&quot; /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'admin_favicon'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h2 id="p11">11. 改變HTML編輯器的字型</h2>
<p>隨著Worpress 3.2版更新，HTML編輯器也有所變更了是吧？在我看來這個看得有點辛苦了，於是試著改了字型。<br />
折騰方法很簡單，加插以下代碼到function.php。font-family或字體顏色就任君選擇囉！</p>
<h4>functions.php</h4>

<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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> change_editor_font<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;style type='text/css'&gt;
#editorcontainer textarea#content {
  font-family: <span style="color: #000099; font-weight: bold;">\&quot;</span>ヒラギノ角ゴ Pro W4<span style="color: #000099; font-weight: bold;">\&quot;</span>,
    <span style="color: #000099; font-weight: bold;">\&quot;</span>Hiragino Kaku Gothic Pro<span style="color: #000099; font-weight: bold;">\&quot;</span>,
    <span style="color: #000099; font-weight: bold;">\&quot;</span>Century Gothic&quot;</span>\<span style="color: #339933;">,</span>
    \<span style="color: #0000ff;">&quot;微軟正黑體&quot;</span>\<span style="color: #339933;">,</span>
    Helvetica<span style="color: #339933;">,</span>
    sans<span style="color: #339933;">-</span>serif<span style="color: #339933;">;</span>
  font<span style="color: #339933;">-</span>size<span style="color: #339933;">:</span>14px<span style="color: #339933;">;</span>
  color<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">#333;
</span><span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>style<span style="color: #339933;">&gt;</span><span style="color: #0000ff;">&quot;;
}
add_action(&quot;</span>admin_print_styles<span style="color: #0000ff;">&quot;, &quot;</span>change_editor_font<span style="color: #0000ff;">&quot;);</span></pre></td></tr></table></div>

<blockquote><p>
追加<br />
當升級成Wordpress 3.3版時，ID好像改了。照下面的改了它就OK了！</p>
<p><code>#wp-content-wrap textarea#content.wp-editor-area {</code>
</p></blockquote>
<ul>
<li>via：<a href="http://www.wprecipes.com/how-to-change-wordpress-editor-font">How to change WordPress editor font</a></li>
</ul>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h2 id="p12">12. 讓文章能加插獨立CSS</h2>
<p>不管是文章或是頁面，有時也想為它們加添獨立的CSS。根據這點，在這兒給出兩個小提示。其一是在外部呼叫CSS，其二是加入style屬性然後輸出至head標籤內。</p>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>12.1. 外部呼叫CSS</h3>
<p>首先要製作好CSS，然後上傳至主機的方法。寫完獨立CSS後，要把該文章ID加插在檔案名後面。例如style-100.css(style-ID.css)。接著，在functions.php加插以下代碼：</p>
<h4>functions.php</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> article_id_style<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: #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: #000088;">$currentID</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$serverfilepath</span> <span style="color: #339933;">=</span> TEMPLATEPATH<span style="color: #339933;">.</span><span style="color: #0000ff;">'/css/style-'</span><span style="color: #339933;">.</span><span style="color: #000088;">$currentID</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.css'</span><span style="color: #339933;">;</span>     <span style="color: #000088;">$publicfilepath</span> <span style="color: #339933;">=</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$publicfilepath</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'/css/style-'</span><span style="color: #339933;">.</span><span style="color: #000088;">$currentID</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.css'</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$serverfilepath</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;link rel='stylesheet' type='text/css' href='<span style="color: #006699; font-weight: bold;">$publicfilepath</span>' media='screen' /&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: #009900;">&#125;</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;">'article_id_style'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>當主題中的css文件夾有這個檔案時，就會自動貼上外部CSS的連結然後運行它。<br />
是說在我知道這些小知識之前，自己還一直在header.php寫條件判斷w 只要使用文章ID就可以了啊w 原來如此！</p>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>12.2. 在管理頁面「唰」聲地更新</h3>
<p>CSS篇幅夠長的話用上面的方法是挺不錯，但如果只寫了兩、三行的話就要另開CSS的話也就未免太小題大做了。特地又要去主機上傳檔案也很麻煩。以前用過自訂欄位，讓我察覺到下面的代碼了！把它寫進functions.php。</p>
<h4>functions.php</h4>

<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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//Custom CSS Widget</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_menu'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom_css_hooks'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'save_post'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'save_custom_css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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;">'insert_custom_css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> custom_css_hooks<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  add_meta_box<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'custom_css'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Custom CSS'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom_css_input'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'high'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  add_meta_box<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'custom_css'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Custom CSS'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom_css_input'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'page'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'high'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> custom_css_input<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: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;input type=&quot;hidden&quot; name=&quot;custom_css_noncename&quot; id=&quot;custom_css_noncename&quot; value=&quot;'</span><span style="color: #339933;">.</span>wp_create_nonce<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'custom-css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;textarea name=&quot;custom_css&quot; id=&quot;custom_css&quot; rows=&quot;5&quot; cols=&quot;30&quot; style=&quot;width:100%;&quot;&gt;'</span><span style="color: #339933;">.</span>get_post_meta<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: #339933;">,</span><span style="color: #0000ff;">'_custom_css'</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/textarea&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> save_custom_css<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_id</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: #339933;">!</span>wp_verify_nonce<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'custom_css_noncename'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom-css'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #000088;">$post_id</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DOING_AUTOSAVE'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> DOING_AUTOSAVE<span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #000088;">$post_id</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$custom_css</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'custom_css'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  update_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'_custom_css'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$custom_css</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> insert_custom_css<span style="color: #009900;">&#40;</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>is_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</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: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>have_posts<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: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;style type=&quot;text/css&quot;&gt;'</span><span style="color: #339933;">.</span>get_post_meta<span style="color: #009900;">&#40;</span>get_the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'_custom_css'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/style&gt;'</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span>
      rewind_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><img src="https://lh4.googleusercontent.com/-pt_GY2w5PPU/TwcxDXm7XUI/AAAAAAAAAHo/TKmmwMswC0c/s439/275.png" /></p>
<p>出現了獨立CSS專用box! 在這兒鍵入CSS，就會輸出在head裡面的style屬性了。</p>
<blockquote><p>via：<a href="http://digwp.com/2010/02/custom-css-per-post/">Custom CSS Per Post</a></p></blockquote>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h2 id="p13">13. 面對客戶？的自訂方法</h2>
<p>這自設定未必真正需要在個人博客中使用，不過如果這是要給客戶的成品的話，可能需要折騰一下了……其實就是要自訂很多東西。</p>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>13.1 管理畫面的logo</h3>
<p>如果這是需要交給客戶的話，管理畫面的logo有可能需要改一下。添加以下代碼至functions.php，覆蓋原有的CSS吧。<br />
<img src="https://lh4.googleusercontent.com/-u4Cw5ey9H4g/Twc1HVz3m2I/AAAAAAAAAIA/02mK7Uhgk0k/s316/276.png" /></p>
<h4>functions.php</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> my_custom_logo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;style type=&quot;text/css&quot;&gt;
#header-logo { background-image: url('</span><span style="color: #339933;">.</span>get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/images/custom-logo.gif) !important; }
&lt;/style&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_custom_logo'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>WordPress 3.2版開始，logo的變得小了點。大小是<strong>16px x 16px</strong>。把 custom-logo.gif 上傳至主題目錄的 images 文件夾就行了。</p>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>13.2 底部的文字</h3>
<p>配合logo，底部的文字（注：「感謝您使用 WordPress……」那處）也是需要變更的。添加以下代碼至functions.php。</p>
<h4>functions.php</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> remove_footer_admin <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'如需查詢請到&lt;a href=&quot;http://webdesignrecipes.com/contact/&quot; target=&quot;_blank&quot;&gt;Web Design Recipes&lt;/a&gt;。'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_footer_text'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'remove_footer_admin'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>要把顯示的文字（echo以下）改掉喔！</p>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>13.3 刪除管理列</h3>
<p><img src="https://lh3.googleusercontent.com/-qForUVwyYi8/Twc8NEorlrI/AAAAAAAAAIY/r1m6gmZnqkc/s365/277.png" /></p>
<p>由Wordpress 3.1版開始登場的管理列。如果沒需要的話也刪除它好了。在<strong>管理頁面 → 帳號 → 個人資訊 → 顯示管理列</strong>中剔除它就可以關閉這個功能。不過每位客戶都這樣折騰不會太麻煩嗎？如果使用者多了起來時也會更糟糕。添加以下代碼至functions.php就可以簡單刪除它。</p>
<h4>functions.php</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> disable_admin_bar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'show_admin_bar'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'disable_admin_bar'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<ul>
<li>參考：<a href="http://codex.wordpress.org/Function_Reference/show_admin_bar">WordPress CODEX: Function Reference/show admin bar</a></li>
</ul>
<p>return false&#8230;好像可以寫得更簡單吧。下面一行就能秒殺了。</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'show_admin_bar'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'__return_false'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>以後就記住這個寫法吧w</p>
<p>不過這樣的話，剛才<strong>帳戶 → 個人資訊 → 顯示管理列</strong>的部份還是會設定顯示它。如果想這部份也一併消除掉的話，在understandard童鞋的博客也有介紹：</p>
<ul>
<li>via：<a href="http://www.understandard.net/wordpress/wp021.html">WordPress 3.1で追加された管理バーを非表示にする方法</a></li>
</ul>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>13.4 登入畫面logo</h3>
<p>在Wordpress的登入頁面，有著大大的logo。也許這個變成客戶的logo會比較好。如果手中已有素材的話，在functions.php添加以下代碼。</p>
<h4>functions.php</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> my_custom_login_logo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;style type=&quot;text/css&quot;&gt;
h1 a { background-image:url('</span><span style="color: #339933;">.</span>get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/images/custom-login-logo.gif) !important; }     &lt;/style&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
 add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'login_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_custom_login_logo'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>圖片大小（h1 a 標籤的大小）是 <strong>326px x 82px </strong>(WordPress 3.2)！</p>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>13.5 全體改變登入畫面</h3>
<p>「不光是登入logo，想把背景、連結顏色等等的都改掉！」的時候，在functions.php添加以下代碼，讀取外部CSS檔案就可以了。</p>
<h4>functions.php</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> custom_login<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;'</span><span style="color: #339933;">.</span>get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/login.css&quot; /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'login_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom_login'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>配合login.css的位置，改變其路徑！</p>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>13.6 從個人資料中刪除不要的項目</h3>
<p>在<strong>管理頁面 → 帳號 → 個人資訊</strong>中看了看，真的有好多項目呢。AIM、Yahoo IM、Jabber / Google Talk之類的…這些都可以刪除的。其實這些是神馬來的？即使客戶這樣問了解釋給他聽也會不明白的w 所以在functions.php添加以下代碼，刪除它們吧。</p>
<p><img src="https://lh6.googleusercontent.com/-tIGeQYbfMNY/TwdOdjOI73I/AAAAAAAAAKA/b0WbsbR6TKY/s552/278.png" /></p>
<h4>functions.php</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> hide_profile_fields<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$contactmethods</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$contactmethods</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'aim'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$contactmethods</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'jabber'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$contactmethods</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'yim'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$contactmethods</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user_contactmethods'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'hide_profile_fields'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>13.7 相反的替個人資料增加項目</h3>
<p>相反地，今回試著增加項目。</p>
<h4>functions.php</h4>

<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> my_new_contactmethods<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$contactmethods</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">/* twitter */</span>
<span style="color: #000088;">$contactmethods</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'twitter'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Twitter'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">/* facebook */</span>
<span style="color: #000088;">$contactmethods</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'facebook'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Facebook'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">/* Google+ */</span>
<span style="color: #000088;">$contactmethods</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'g_plus'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Google+'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$contactmethods</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user_contactmethods'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'my_new_contactmethods'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>（注：目前 WordPress 已內建 twitter 和 facebook 這兩個項目，故只需打上 google+ 那項就好）<br />
有一點要注意的是，<strong>$contactmethods['g_plus']</strong> 中，g_plus的部分。由於這個將會成為<strong>資料庫的欄位部分</strong>所以有些字形是不能用的。不過用英數字命名倒沒問題。</p>
<p><img src="https://lh6.googleusercontent.com/-Xtj-nTe6OX0/TwdMj9D3tGI/AAAAAAAAAJk/frF3-WZREz4/s546/279.png" /></p>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>13.8 顯示個人資料</h3>
<p>今回試著展示一下個人資料。在多個作者共筆的博客裡，文章下方一定會顯示著者的簡歷和頭像吧！現在就是試著折騰那個。<br />
<img src="https://lh5.googleusercontent.com/-gHHnL1OwK58/Twga2QOH5wI/AAAAAAAAALQ/osAxmvQJQ24/s700/281.png" /><br />
（注：此乃ai產物…技術不是一般的爛orz）</p>
<h4>sidebar.php</h4>

<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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;h2&gt;About Author&lt;/h2&gt;
&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author_meta<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt; /* 網站 */
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_avatar<span style="color: #009900;">&#40;</span> get_the_author_meta<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user_email'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'80'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/a&gt;
&lt;h3&gt;Written by <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author_link<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>&lt;/h3&gt; /* 網名 */
&lt;p&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author_meta<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'description'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> /* 自我介紹 */
我還有撰寫&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_author_posts_url<span style="color: #009900;">&#40;</span> get_the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'ID'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;其他&lt;/a&gt;文章喔！ /* 作者的文章一覽連結 */
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://twitter.com/<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author_meta<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'twitter'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; target=&quot;_blank&quot;&gt;Twitter&lt;/a&gt;&lt;/li&gt; /* Twitter */
&lt;li&gt;&lt;a href=&quot;http://www.facebook.com/<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author_meta<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'facebook'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; target=&quot;_blank&quot;&gt;Facebook&lt;/a&gt;&lt;/li&gt; /* Facebook */
&lt;li&gt;&lt;a href=&quot;https://plus.google.com/<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author_meta<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'g_plus'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/about&quot; target=&quot;_blank&quot;&gt;Google+&lt;/a&gt;&lt;/li&gt; /* Google+ */
&lt;/ul&gt;</pre></td></tr></table></div>

<p>個人簡歷可以用 <strong>the_author_meta</strong> 提取！不過條件是只限於在文章循環內使用。由上面的例子可以看到也有用 get_avatar 之類的函數提取頭像。</p>
<ul style="list-style-position:outside; !important;margin-left:20px;">
<li><code>get_avatar( get_the_author_meta('user_email'), '80', '' )</code><br />從Gravatar提取頭像，80 是指 80px x 80px 的意思。</li>
<li><code>the_author_meta('user_url')</code><br />
輸出個人資料中網址欄位的數值。</li>
<li><code>the_author_meta('description')</code><br />
輸出個人資料欄位（自我介紹之類的）的數值。</li>
<li><code>the_author_meta('twitter') </code><br />
剛才折騰完的 twitter 值… facebook 及 g_plus 也是同樣做法。</li>
<li><code>the_author_link()</code><br />
你在該博客的顯示名稱。如果你有在網址欄位打上自己的網址，就會自動給出連結。</li>
<li><code>get_author_posts_url( get_the_author_meta( 'ID' ) )</code><br />
如果按下了這個連結，就可以看回同一作者寫過的文章（author.php、index.php…）頁面。</li>
</ul>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>13.9 除了管理員以外不表示升級通知</h3>
<p>當Wordpress有更新時，在管理頁面的最頂部會有一條黃色的通知欄是吧！的確是個很方便的功能，不過可能客戶會不想顯示它，<strong>請叫管理員幫你升級！</strong>…會看成這樣吧w</p>
<p><img src="https://lh5.googleusercontent.com/-GTfMKlW1Rho/TwdRxC255TI/AAAAAAAAAKc/or47UZAADkk/s384/280.png" /></p>
<p>在客戶的角度看，即使我是管理員，客戶也是作者。所以要讓升級通知顯示給管理員的同時，也要設置權限禁止作者或以下階級顯示通知。</p>
<h4>functions.php</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>current_user_can<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'edit_users'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">function</span> wphidenag<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    remove_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'admin_notices'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'update_nag'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_menu'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'wphidenag'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>if (current_user_can(&#8216;edit_users&#8217;))</strong> 是指擁有帳戶編輯（edit_user）權限的意思。在上面的代碼，最頂的一行帶著 <strong>!</strong> 的意思就是<strong>沒有帳戶編輯權限</strong>的意思喔！</p>
<ul>
<li>參考：<a href="http://codex.wordpress.org/Roles_and_Capabilities">WordPress CODEX Roles and Capabilities</a></li>
<li>via：<a href="http://speckyboy.com/2011/04/27/20-snippets-and-hacks-to-make-wordpress-user-friendly-for-your-clients/">20 Snippets and Hacks to Make WordPress User-Friendly for your Clients</a></li>
</ul>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>13.10. 針對非管理員使用者，不表示一些不常用到的項目</h3>
<p>剛才關閉顯示的對象是升級通知，今次是針對管理畫面中的<strong>目錄</strong>。媒體、工具、安裝了<a href="http://wordpress.org/extend/plugins/contact-form-7/" target="_blank">Contact Form 7</a>（是一個郵箱插件）之後就會在目錄新增一個<strong>聯絡表單</strong>的項目。明明客戶沒需要用到但肯定會被問「這個又是神馬？」，光是聽了就有不想被你玩弄的感覺啊。</p>
<p><img src="https://lh6.googleusercontent.com/-nTKA43IqLQg/TwgwThRz3uI/AAAAAAAAALo/0YjoZnUcMMs/s298/282.png" /></p>
<p>這個也設定成管理員以外不給看好了。</p>
<h4>functions.php</h4>

<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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>current_user_can<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'edit_users'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">function</span> remove_menus <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;">$menu</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$restricted</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
      __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'媒體'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'工具'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'聯絡表單'</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">end</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$menu</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">prev</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$menu</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span><span style="color: #000088;">$menu</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">key</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$menu</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</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: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #009900; font-weight: bold;">NULL</span>?<span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #0000ff;">&quot;&quot;</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$restricted</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$menu</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">key</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$menu</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</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: #009900;">&#125;</span>
  add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_menu'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'remove_menus'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>上面的例子會取消顯示<strong>媒體、工具和聯絡表單</strong>這三個項目。</p>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>13.11. 指定某些使用者的管理畫面不會顯示某些項目</h3>
<p>今次不是要設權限，而是特定對某些使用者不會顯示項目。例如是多位管理員時，應該不想被他人碰固定分頁之類的地方的。這時候就要用下面給出的方法。</p>
<h4>functions.php</h4>

<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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> remove_menus <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;">$menu</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$current_user</span><span style="color: #339933;">;</span>
  get_currentuserinfo<span style="color: #009900;">&#40;</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;">$current_user</span> <span style="color: #339933;">-&gt;</span> <span style="color: #004000;">user_login</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'Nori'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$restricted</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
      __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'媒體'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'連結'</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">end</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$menu</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">prev</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$menu</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span><span style="color: #000088;">$menu</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">key</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$menu</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</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: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #009900; font-weight: bold;">NULL</span>?<span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #0000ff;">&quot;&quot;</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$restricted</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$menu</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">key</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$menu</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</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: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_menu'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'remove_menus'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>if($current_user -> user_login == &#8216;Nori&#8217;)</strong> 中的 <strong>&#8216;Nori&#8217;</strong> 是該使用者的ID。這樣的話，用戶ID Nori 桑就不會在管理畫面見到媒體和連結這兩個項目了。</p>
<ul>
<li>參考：<a href="http://codex.wordpress.org/Function_Reference/get_currentuserinfo">WordPress CODEX: get currentuserinfo</a></li>
</ul>
<div class="to-index">
	<a href="#top_index">↑ 返回目錄</a>
</div>
<h3>13.12. 消除文章發布畫面中不想要的自訂區塊 (meta box)</h3>
<p>在Wordpress中的文章發布畫面，真的很多自訂區塊呢。</p>
<p><img src="https://lh3.googleusercontent.com/-31wbTtNuRqM/TwhHZmG02dI/AAAAAAAAAMA/G6y3n5SuUdg/s746/283.png" /></p>
<p>如果不想要這些東西的話，選擇不顯示它們也許不會讓客戶感到眼花。因為誰都想要一個簡單、易到的操作介面嘛！<br />
於functions.php刪除不想顯示的區塊。</p>
<h4>functions.php</h4>

<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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>current_user_can<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'edit_users'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">function</span> remove_extra_meta_boxes<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'postcustom'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'post'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 編輯文章：自訂欄位 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'postcustom'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'page'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 固定分頁：自訂欄位 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'postexcerpt'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'post'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 編輯文章：文章摘要 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'postexcerpt'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'page'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 固定分頁：文章摘要 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'commentsdiv'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'post'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 編輯文章：迴響 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'commentsdiv'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'page'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 固定分頁：迴響 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'tagsdiv-post_tag'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'post'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'side'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 編輯文章：標籤 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'tagsdiv-post_tag'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'page'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'side'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 固定分頁：標籤 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'trackbacksdiv'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'post'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 編輯文章：傳送引用 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'trackbacksdiv'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'page'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 固定分頁：傳送引用 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'commentstatusdiv'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'post'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 編輯文章：討論 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'commentstatusdiv'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'page'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 固定分頁：討論 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'slugdiv'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'post'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'normal'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 編輯文章：代稱 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'slugdiv'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'page'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'normal'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 固定分頁：代稱 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'authordiv'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'post'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'normal'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 編輯文章：作者 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'authordiv'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'page'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'normal'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 固定分頁：作者 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'revisionsdiv'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'post'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'normal'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 編輯文章：文章版本 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'revisionsdiv'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'page'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'normal'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 固定分頁：文章版本 */</span>
    remove_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'pageparentdiv'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'page'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'side'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 固定分頁：分頁屬性 */</span>
  <span style="color: #009900;">&#125;</span>
  add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'admin_menu'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'remove_extra_meta_boxes'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<ul>
<li>參考：WordPress CODEX <a href="http://codex.wordpress.org/Function_Reference/remove_meta_box">Function Reference/remove meta box</a></li>
<li>via：<a href="http://kachibito.net/wordpress/add-my-functions.html">WordPressを使ったWebサイトでfunctions.phpによく書いてるやつ</a></li>
</ul>
<p>雖然不算是一篇很有脈絡文章且各式各樣的代碼非常多，但我還是把自己經常用到的自訂代碼整理了一次。感謝參考資料中列出的網頁以及博客 ;D</p>
]]></content:encoded>
			<wfw:commentRss>http://rinkaiten.com/38.html/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Happy New Year!!</title>
		<link>http://rinkaiten.com/45.html</link>
		<comments>http://rinkaiten.com/45.html#comments</comments>
		<pubDate>Sat, 31 Dec 2011 19:21:15 +0000</pubDate>
		<dc:creator>小闇</dc:creator>
				<category><![CDATA[隨筆]]></category>

		<guid isPermaLink="false">http://rinkaiten.com/?p=45</guid>
		<description><![CDATA[今年的願望是胃痛退散。 珍惜生命，請遠離功課。（嘆氣）]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter" src="https://lh6.googleusercontent.com/-VYK96oZGbh8/Tv9fkTKFlCI/AAAAAAAAADM/bc6hshAz0-Y/s700/265.jpg" alt="" /></p>
<p>今年的願望是胃痛退散。<br />
珍惜生命，請遠離功課。（嘆氣）</p>
]]></content:encoded>
			<wfw:commentRss>http://rinkaiten.com/45.html/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>[Cydia]1.1.3版在繁中/簡中下閃退之解決方法</title>
		<link>http://rinkaiten.com/44.html</link>
		<comments>http://rinkaiten.com/44.html#comments</comments>
		<pubDate>Wed, 28 Dec 2011 09:06:16 +0000</pubDate>
		<dc:creator>小闇</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Jailbreak]]></category>

		<guid isPermaLink="false">http://rinkaiten.com/?p=44</guid>
		<description><![CDATA[應該是Cydia 1.1.3版的bug。現有兩種解決方法： 變換設備語言至英文 複製/var/mobile/Library/中的Keyboard文件夾至/var/root/Library/，不用重啟即可修復。]]></description>
			<content:encoded><![CDATA[<p>應該是Cydia 1.1.3版的bug。現有兩種解決方法：</p>
<ol>
<li>變換設備語言至英文</li>
<li>複製/var/mobile/Library/中的Keyboard文件夾至/var/root/Library/，不用重啟即可修復。</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://rinkaiten.com/44.html/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>New wordpress theme: Renova</title>
		<link>http://rinkaiten.com/42.html</link>
		<comments>http://rinkaiten.com/42.html#comments</comments>
		<pubDate>Sat, 24 Dec 2011 12:57:49 +0000</pubDate>
		<dc:creator>小闇</dc:creator>
				<category><![CDATA[折騰]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress theme]]></category>

		<guid isPermaLink="false">http://rinkaiten.com/?p=42</guid>
		<description><![CDATA[今次是看中了一位外國人寫的主題。昨天開始動工把它中文化、順道修改看不順眼的地方……折騰這折騰那都快四時了！ 覺得有問題的地方還挺多的，最主要的是留言者資料那兒吧，每個都相隔50 pixel實在是太長了… 另外這主題是流體布局，兼容平板電腦及手機，有這兩種設備的童鞋不妨看看其布局有什麼變化^_^ PS 今天是平安夜，祝各位童鞋性誕節快樂（ ・∀・）（大誤）]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter" style="border: none;" src="https://lh6.googleusercontent.com/-JzKV-9IhOUc/TvW2LD2MeWI/AAAAAAAAAC0/c49wj8sb8Vs/s1000/264.png" alt="" /></p>
<p>今次是看中了一位外國人寫的主題。昨天開始動工把它中文化、順道修改看不順眼的地方……折騰這折騰那都快四時了！<br />
覺得有問題的地方還挺多的，最主要的是留言者資料那兒吧，每個都相隔50 pixel實在是太長了…<br />
另外這主題是流體布局，兼容平板電腦及手機，有這兩種設備的童鞋不妨看看其布局有什麼變化^_^</p>
<p>PS 今天是平安夜，祝各位童鞋性誕節快樂（ ・∀・）<span style="color: #888888;">（大誤）</span></p>
]]></content:encoded>
			<wfw:commentRss>http://rinkaiten.com/42.html/feed</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>今年聖誕絕不美好</title>
		<link>http://rinkaiten.com/36.html</link>
		<comments>http://rinkaiten.com/36.html#comments</comments>
		<pubDate>Mon, 12 Dec 2011 10:37:39 +0000</pubDate>
		<dc:creator>小闇</dc:creator>
				<category><![CDATA[隨筆]]></category>
		<category><![CDATA[日常]]></category>
		<category><![CDATA[杯具]]></category>

		<guid isPermaLink="false">http://rinkaiten.com/?p=36</guid>
		<description><![CDATA[跟老媽互換了手機用，現在她用iphone3G我用Galaxy S I9003。嗯，玩夠iOS了是時候找別的東西玩。總感覺iOS折騰來折騰去都是那些特效啊～優化啊～美化啊～很不爽，應該可以令自己的手機變得更個性化的，這樣想著就開始用起android了。目前不懂得root機刷rom，官方rom用起來有點不上手，待假期就去請教朋友(*´ω｀*) 功課依然是那麼忙啊，有幾天都沒睡覺趕進度了。那天下車時眼睛完全睜不起來啊悲劇！！我感覺到人們飄來(゜_゜)的視線，不要看我啊！！orz 明天測program但我趕完前一份project根本沒時間溫習，聽天由命。]]></description>
			<content:encoded><![CDATA[<p>跟老媽互換了手機用，現在她用iphone3G我用Galaxy S I9003。嗯，玩夠iOS了是時候找別的東西玩。總感覺iOS折騰來折騰去都是那些特效啊～優化啊～美化啊～很不爽，應該可以令自己的手機變得更個性化的，這樣想著就開始用起android了。目前不懂得root機刷rom，官方rom用起來有點不上手，待假期就去請教朋友(*´ω｀*)</p>
<p>功課依然是那麼忙啊，有幾天都沒睡覺趕進度了。那天下車時眼睛完全睜不起來啊悲劇！！我感覺到人們飄來(゜_゜)的視線，不要看我啊！！orz<br />
明天測program但我趕完前一份project根本沒時間溫習，聽天由命。</p>
]]></content:encoded>
			<wfw:commentRss>http://rinkaiten.com/36.html/feed</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>2011-11-28，入手了銀他媽最新OP</title>
		<link>http://rinkaiten.com/30.html</link>
		<comments>http://rinkaiten.com/30.html#comments</comments>
		<pubDate>Mon, 28 Nov 2011 10:25:12 +0000</pubDate>
		<dc:creator>小闇</dc:creator>
				<category><![CDATA[隨筆]]></category>
		<category><![CDATA[ecosystem]]></category>
		<category><![CDATA[銀魂]]></category>

		<guid isPermaLink="false">http://rinkaiten.com/?p=30</guid>
		<description><![CDATA[最近的CD又流行偷跑（還是一直都是這樣？），聽說supercell的My Dearest偷步2-3天開始發售，今天就去旺角看看銀魂的OP有沒有上架。不出所料。 前OP「桃源郷エイリアン」一直是我認為是眾OP中最燃的，不過自Love plus篇開始就換成ecosystem的新曲了。播到副歌很令人意外，集結了銀時vs眾boss的打鬥場面剪影。我比較眼殘，只看到鳳仙、似藏、河上和地雷亞， ╮(╯_╰)╭ 。果然追銀魂是為了看銀時耍帥的啊]]></description>
			<content:encoded><![CDATA[<p><a href="https://lh6.googleusercontent.com/-jYRjPd0Q9M0/TtNcDVjFn6I/AAAAAAAAACg/zQZQtCGclz8/s365/263.png"><img class="aligncenter" src="https://lh6.googleusercontent.com/-jYRjPd0Q9M0/TtNcDVjFn6I/AAAAAAAAACg/zQZQtCGclz8/s365/263.png" alt="" /></a><br />
<embed src="http://rinkaiten.com/wp-content/themes/Renova/mp3player.swf?url=http://storage.live.com/items/BBD3A9D93944B783!5028?filename=01%20%E3%82%B8%E3%83%AC%E3%83%B3%E3%83%9E.mp3&amp;autoplay=0" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always" width="400" height="30"><br />
最近的CD又流行偷跑（還是一直都是這樣？），聽說supercell的My Dearest偷步2-3天開始發售，今天就去旺角看看銀魂的OP有沒有上架。不出所料。<br />
前OP「桃源郷エイリアン」一直是我認為是眾OP中最燃的，不過自Love plus篇開始就換成ecosystem的新曲了。播到副歌很令人意外，集結了銀時vs眾boss的打鬥場面剪影。我比較眼殘，只看到鳳仙、似藏、河上和地雷亞， ╮(╯_╰)╭ 。<del>果然追銀魂是為了看銀時耍帥的啊</del></p>
]]></content:encoded>
			<wfw:commentRss>http://rinkaiten.com/30.html/feed</wfw:commentRss>
		<slash:comments>21</slash:comments>
<enclosure url="http://storage.live.com/items/BBD3A9D93944B783!5028?filename=01%20%E3%82%B8%E3%83%AC%E3%83%B3%E3%83%9E.mp3" length="9573682" type="audio/mpeg" />
		</item>
		<item>
		<title>2011-11-23，好想一腳踹死VB</title>
		<link>http://rinkaiten.com/28.html</link>
		<comments>http://rinkaiten.com/28.html#comments</comments>
		<pubDate>Wed, 23 Nov 2011 12:35:21 +0000</pubDate>
		<dc:creator>小闇</dc:creator>
				<category><![CDATA[隨筆]]></category>
		<category><![CDATA[日常]]></category>
		<category><![CDATA[杯具]]></category>

		<guid isPermaLink="false">http://rinkaiten.com/?p=28</guid>
		<description><![CDATA[dim, array, loop, listbox, button, !@#$%^&#038;*(&#038;^%$#@! 腦袋的OS還是windows 95的我表示512mb的RAM快額滿了CPU快爆炸了！！我感覺到耳朵那邊的風扇的轉速不是一般的強啊！ 媽媽啊！程式神馬的不是我的專長啊！下星期還要折騰好功課交給他啊！靠你要我怎樣在對VB一竅不通的情況下交給他啊！忙死了啊啊啊啊啊啊－－－ (;つД｀)]]></description>
			<content:encoded><![CDATA[<p>dim, array, loop, listbox, button, !@#$%^&#038;*(&#038;^%$#@!</p>
<p>腦袋的OS還是windows 95的我表示512mb的RAM快額滿了CPU快爆炸了！！我感覺到耳朵那邊的風扇的轉速不是一般的強啊！<br />
媽媽啊！程式神馬的不是我的專長啊！下星期還要折騰好功課交給他啊！靠你要我怎樣在對VB一竅不通的情況下交給他啊！忙死了啊啊啊啊啊啊－－－</p>
<p>(;つД｀)</p>
]]></content:encoded>
			<wfw:commentRss>http://rinkaiten.com/28.html/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Media Queries初探</title>
		<link>http://rinkaiten.com/23.html</link>
		<comments>http://rinkaiten.com/23.html#comments</comments>
		<pubDate>Mon, 21 Nov 2011 10:48:56 +0000</pubDate>
		<dc:creator>小闇</dc:creator>
				<category><![CDATA[折騰]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Media Queries]]></category>

		<guid isPermaLink="false">http://rinkaiten.com/?p=23</guid>
		<description><![CDATA[其實說白了這個人看了無數的實例與外國一些高手的超詳盡教學，這人現在還是處於一頭霧水的狀態…最重要的是即使勉強折騰好也不見得有多明顯啊（主題太簡約所致）！兼容手機那邊也好難折騰啊！魂淡！ 賞臉圍觀劣作的童鞋可以把瀏覽器視窗縮放觀看效果。注意IE目前只能用最新版瀏覽，我沒掛上JS兼容插件啊。 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 /*------------------------------------------------ # Media Queries ------------------------------------------------*/ @media screen and (max-width: 950px) { /* 視窗到達950px */ &#160; #container &#123; width: 95%; /* 整體縮窄至原來的95% */ &#125; &#160; .post&#123; margin-left:0 [...]]]></description>
			<content:encoded><![CDATA[<p>其實說白了這個人看了無數的實例與外國一些高手的超詳盡教學，這人現在還是處於一頭霧水的狀態…最重要的是即使勉強折騰好也不見得有多明顯啊（主題太簡約所致）！兼容手機那邊也好難折騰啊！魂淡！<br />
賞臉圍觀劣作的童鞋可以把瀏覽器視窗縮放觀看效果。注意IE目前只能用最新版瀏覽，我沒掛上JS兼容插件啊。</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
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*------------------------------------------------
	# Media Queries
------------------------------------------------*/</span>
<span style="color: #a1a100;">@media screen and (max-width: 950px) { /* 視窗到達950px */</span>
&nbsp;
    <span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">95%</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* 整體縮窄至原來的95% */</span>
    <span style="color: #00AA00;">&#125;</span>
&nbsp;
    .post<span style="color: #00AA00;">&#123;</span>
    	<span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span> !important<span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* 取消左邊距（還留著的話不就變成錯位了嗎） */</span>
    <span style="color: #00AA00;">&#125;</span>
&nbsp;
    <span style="color: #cc00cc;">#footer</span> <span style="color: #00AA00;">&#123;</span>
    	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* 底部隨著縮放依然維持100%不變 */</span>
    <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #a1a100;">@media screen and (max-width: 600px) { /* 視窗到達650px */</span>
    .face<span style="color: #00AA00;">&#123;</span>
	    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* 表情寬度自定義 */</span>
    <span style="color: #00AA00;">&#125;</span>
    <span style="color: #cc00cc;">#searchform</span><span style="color: #00AA00;">,</span>ol<span style="color: #6666ff;">.commentlist</span> li span.comment-meta<span style="color: #00AA00;">&#123;</span>
	    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* 太窄的時候就不顯示了 */</span>
    <span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>目前就只能寫出這樣蛋痛的東西（自pia）…有時間繼續折騰orz</p>
<blockquote><p>Hardboiled CSS3 Media Queries<br />
<a href="http://www.stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries/">http://www.stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries/</a></p>
<p>Responsive Design with CSS3 Media Queries<br />
<a href="http://webdesignerwall.com/tutorials/responsive-design-with-css3-media-queries">http://webdesignerwall.com/tutorials/responsive-design-with-css3-media-queries</a></p>
<p>CSS3 Media Queries を使って、Webサイトをスマートフォンに対応させるときの注意書き<br />
<a href="http://webdesignrecipes.com/web-design-for-mobile-with-css3-media-queries/">http://webdesignrecipes.com/web-design-for-mobile-with-css3-media-queries/</a></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://rinkaiten.com/23.html/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

