<?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>NeatCN(NeatStudio工作室) &#187; add_filter</title>
	<atom:link href="http://www.neatcn.com/tags/add_filter/feed" rel="self" type="application/rss+xml" />
	<link>http://www.neatcn.com</link>
	<description>NeatStudio工作室</description>
	<lastBuildDate>Fri, 09 Dec 2011 13:07:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>测试最简单的插件</title>
		<link>http://www.neatcn.com/show-26-1.shtml</link>
		<comments>http://www.neatcn.com/show-26-1.shtml#comments</comments>
		<pubDate>Tue, 16 Mar 2010 01:37:29 +0000</pubDate>
		<dc:creator>膘叔</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Wordpress开发]]></category>
		<category><![CDATA[add_filter]]></category>

		<guid isPermaLink="false">http://www.neatcn.com/?p=26</guid>
		<description><![CDATA[尝试使用wordpress的时候，看了一下插件的简要信息，说白了，就是一个add_filter在调用相关信息。于是参照hello_dolly插件写了一个最简单的插件，也就是在文章内容后面加上一个版权信息。好象除了默认的模版外，其他就没有这样的提示了。所以，我就开始这样的尝试。 /** * @package NeatCN Copyright * @author neatcn / gouki * @version 0.1 */ /* Plugin Name: NeatCN WordPress Copyright Plugin URI: http://neatcn.com/# Description: 显示文章的版权信息 Author: NeatCN / gouki Version: 0.1 Author URI: http://neatcn.com/ */ function neatCopyRight ( $content &#8230; <a href="http://www.neatcn.com/show-26-1.shtml">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>尝试使用wordpress的时候，看了一下插件的简要信息，说白了，就是一个add_filter在调用相关信息。于是参照hello_dolly插件写了一个最简单的插件，也就是在文章内容后面加上一个版权信息。好象除了默认的模版外，其他就没有这样的提示了。所以，我就开始这样的尝试。</p>
<pre class="brush:php">
/**
 * @package NeatCN Copyright
 * @author neatcn / gouki
 * @version 0.1
 */
/*
Plugin Name: NeatCN WordPress Copyright
Plugin URI: http://neatcn.com/#
Description: 显示文章的版权信息
Author: NeatCN / gouki
Version: 0.1
Author URI: http://neatcn.com/
*/
function neatCopyRight ( $content )
{
	$content .= < <<EOT

wordpress测试插件【显示版权信息】，显示在文章结尾
EOT;
	echo( $content );
}
add_filter('the_content' , 'neatCopyRight' , 1 , 1000);
</pre>
<p>于是在文章内容结束后就有了这一行信息。当然上面仅仅是测试，我不会满足这点的。于是我对neatCopyRight进行了改进，插件也就变成了0.2版了。</p>
<pre class="brush:php">
/*
  说明，the_time，the_category这些函数在文章里居然没有输出值，所以还需要研究一下
  0.2是个失败的作品，晚上回家继续研究
 */
function neatCopyRight ( $content )
{
	$postTime = the_time('l, F jS, Y') . the_time();
	$currentCate = the_category(', ');
	$rssLink = post_comments_feed_link('RSS 2.0');
	$content .= < <<EOT
		<!-- 您可以参考wp-content/themes/default/single.php -->

本文发表于 $postTime , 隶属于 $currentCate 分类，你可以订阅本文的评论：$rssLink 

EOT;
	echo( $content );
}
</pre>
<p>第一个插件，连配置啥的都没有。只能算是一个尝试，尝试了一下add_filter函数而己</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatcn.com/show-26-1.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

