<?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>Joe Horn 的啟示錄 &#187; calendar</title>
	<atom:link href="http://www.joehorn.idv.tw/archives/tag/calendar/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joehorn.idv.tw</link>
	<description>Joe Horn's Blog</description>
	<lastBuildDate>Wed, 08 Sep 2010 15:45:55 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>WordPress 的小日曆 bug</title>
		<link>http://www.joehorn.idv.tw/archives/2005/05/31/166/</link>
		<comments>http://www.joehorn.idv.tw/archives/2005/05/31/166/#comments</comments>
		<pubDate>Tue, 31 May 2005 11:49:02 +0000</pubDate>
		<dc:creator>Joe Horn</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[calendar]]></category>

		<guid isPermaLink="false">http://www.joehorn.idv.tw/archives/2005/05/31/166/</guid>
		<description><![CDATA[剛剛我發現我這裡的 calendar 已經跳到 6 月, 像這樣 : 於是去看了 幾 個 站 , 也都有這個問題. 看過程式之後, 果然是 gmt_offset 所產生的問題. 因為在 wp-includes/functions.php 中的 current_time 這個 function 提供了兩種格式: mysql 跟 timestamp . 而 mysql 的格式用了 gmdate , 所以加上 gmt_offset 之後是沒問題的. timestamp 卻因為使用了 time , 所以再加上 gmt_offset 之後會出現異常. 因為我發現只有 calendar 出問題, 所以我只改了 wp-includes/template-functions-general.php 這個檔案, 沒有修改 current_time 這個 function . 如果您的站台的 [...]


Related posts:<ol><li><a href='http://www.joehorn.idv.tw/archives/2007/01/25/239/' rel='bookmark' title='Permanent Link: 升級 WordPress 2.1'>升級 WordPress 2.1</a></li>
<li><a href='http://www.joehorn.idv.tw/archives/2005/02/21/31/' rel='bookmark' title='Permanent Link: WordPress 1.5 的文章分類'>WordPress 1.5 的文章分類</a></li>
<li><a href='http://www.joehorn.idv.tw/archives/2007/11/05/248/' rel='bookmark' title='Permanent Link: 升級成 WordPress 2.3.1'>升級成 WordPress 2.3.1</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div id="fb-like" style=""><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.joehorn.idv.tw/archives/2005/05/31/166/&amp;layout=standard&amp;show_faces=false&amp;width=400&amp;action=like&amp;font=&amp;colorscheme=light&amp;locale=zh_TW" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:400px; height:25px"></iframe></div><p>剛剛我發現我這裡的 calendar 已經跳到 6 月, 像這樣 :<br />
<a href="http://www.joehorn.idv.tw/upload/errCal_me.gif" title="點選小圖放大" target="_blank" rel="lightbox[166]"><img src="http://www.joehorn.idv.tw/upload/errCal_me.gif" width="400" alt="WP Calendar error" /></a></p>
<p>於是去看了 <a href="http://blog.23corner.com/" title="二三街角" target="_blank">幾</a> <a href="http://blog.ijliao.info/" title="國二菜鳥忙裡偷閒" target="_blank">個</a> <a href="http://www.evil-elf.net/" title="雜唸空間" target="_blank">站</a> , 也都有這個問題.</p>
<p>看過程式之後, 果然是 gmt_offset 所產生的問題.</p>
<p>因為在 wp-includes/functions.php 中的 current_time 這個 function 提供了兩種格式: mysql 跟 timestamp .<br />
而 mysql 的格式用了 gmdate , 所以加上 gmt_offset 之後是沒問題的.<br />
timestamp 卻因為使用了 time  , 所以再加上 gmt_offset 之後會出現異常.<br />
因為我發現只有 calendar 出問題, 所以我只改了 wp-includes/template-functions-general.php 這個檔案, 沒有修改 current_time 這個 function .</p>
<p>如果您的站台的 calendar 也有相同問題的話, 請修改 wp-includes/template-functions-general.php , 把原先這兩行註解掉:</p>
<pre class="brush: php;">$thisyear = gmdate(&quot;Y&quot;, current_time(&quot;timestamp&quot;) + get_settings(&quot;gmt_offset&quot;) * 3600);
$thismonth = gmdate(&quot;m&quot;, current_time(&quot;timestamp&quot;) + get_settings(&quot;gmt_offset&quot;) * 3600);</pre>
<p>加進這兩行 :</p>
<pre class="brush: php;">$thisyear = gmdate(&quot;Y&quot;, current_time(&quot;timestamp&quot;));
$thismonth = gmdate(&quot;m&quot;, current_time(&quot;timestamp&quot;));</pre>
<p>也就是變成這樣 :</p>
<pre class="brush: php;">//        $thisyear = gmdate(&quot;Y&quot;, current_time(&quot;timestamp&quot;) + get_settings(&quot;gmt_offset&quot;) * 3600);
//        $thismonth = gmdate(&quot;m&quot;, current_time(&quot;timestamp&quot;) + get_settings(&quot;gmt_offset&quot;) * 3600);
$thisyear = gmdate(&quot;Y&quot;, current_time(&quot;timestamp&quot;));
$thismonth = gmdate(&quot;m&quot;, current_time(&quot;timestamp&quot;));</pre>
<p>如果您有 shell login 權限的話, 可以到您的 <a href="http://wordpress.org" title="" taregt="_blank">WordPress</a> 主目錄, 然後抓取 <a href="http://www.joehorn.idv.tw/patch/template-functions-general.diff.txt" title="" target="_blank">這個檔案</a> 後用這個指令做修正 :</p>
<blockquote><p>patch < template-functions-general.diff.txt</p></blockquote>
</blockquote>

<!-- start wp-tags-to-technorati 1.02 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/calendar' rel='tag' target='_self'>calendar</a>, <a class='technorati-link' href='http://technorati.com/tag/WordPress' rel='tag' target='_self'>WordPress</a></p>

<!-- end wp-tags-to-technorati -->


<p>Related posts:<ol><li><a href='http://www.joehorn.idv.tw/archives/2007/01/25/239/' rel='bookmark' title='Permanent Link: 升級 WordPress 2.1'>升級 WordPress 2.1</a></li>
<li><a href='http://www.joehorn.idv.tw/archives/2005/02/21/31/' rel='bookmark' title='Permanent Link: WordPress 1.5 的文章分類'>WordPress 1.5 的文章分類</a></li>
<li><a href='http://www.joehorn.idv.tw/archives/2007/11/05/248/' rel='bookmark' title='Permanent Link: 升級成 WordPress 2.3.1'>升級成 WordPress 2.3.1</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.joehorn.idv.tw/archives/2005/05/31/166/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
