<?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>wordpress代码 &#8211; 就爱分享</title>
	<atom:link href="https://www.9host.org/tag/wordpress%E4%BB%A3%E7%A0%81/feed" rel="self" type="application/rss+xml" />
	<link>https://www.9host.org</link>
	<description>最爱分享各种资源的中文独立博客</description>
	<lastBuildDate>Fri, 10 May 2019 02:27:47 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>WordPress文章或页面的最后一次更新（修改）日期时间</title>
		<link>https://www.9host.org/906.html</link>
					<comments>https://www.9host.org/906.html#comments</comments>
		
		<dc:creator><![CDATA[河马大叔]]></dc:creator>
		<pubDate>Sun, 28 Jul 2013 01:00:29 +0000</pubDate>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress代码]]></category>
		<category><![CDATA[更新日期]]></category>
		<category><![CDATA[更新时间]]></category>
		<guid isPermaLink="false">http://www.9host.org/?p=906</guid>

					<description><![CDATA[大叔常常会更新修改域名主机VPS优惠码页面，但是很&#8230;]]></description>
										<content:encoded><![CDATA[<p>大叔常常会更新修改<a href="https://www.9host.org/coupons"><strong>域名主机VPS优惠码</strong></a>页面，但是很希望能够把大叔最后一次编辑页面的时间显示在页面上，这样的话就会让博客的读者觉得信息的可用度比较高，而不是陈旧的信息了。</p>
<p>通过在WordPress官网查询，得知原来the_modified_time()这个函数就是显示最后更新时间，括号中还需要填上WordPress的日期格式。</p>
<p>以下是大叔自行修改的主题代码，让其支持显示最后更新修改时间：<br />
可编辑主题中的single.php和page.php文件，找到里面的</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">&lt;?php the_content(); ?&gt;</pre>
<p>在这上面或下面加上以下代码：</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">
<!--页面最后更新日期 start  -->
<?php if ((get_the_modified_time('Y')*365+get_the_modified_time('z')) > (get_the_time('Y')*365+get_the_time('z'))) : ?>【最后修改日期：<?php the_modified_time('Y年n月j日'); ?>】<?php endif; ?>
<!--页面最后更新日期 end  -->
</pre>
<p>上面一段代码使用了一个条件语句，是仅仅对做过修改的文章才显示更新时间，如果从未做过修改的文章是不会显示最后更新时间的。</p>
<p>效果预览：<a href="https://www.9host.org/coupons" title="2013年域名主机VPS优惠码">https://www.9host.org/coupons</a></p>
<div class="su-note"  style="border-color:#e5e5c6;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFFFE0;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">
函数说明：<br />
get_the_modified_time()——获取最后修改时间；<br />
get_the_time()——获取文章发布时间；<br />
the_modified_time()——显示最后修改时间。<br />
</div></div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.9host.org/906.html/feed</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
