a filter

filter是过滤和处理内容的。两个时刻:发送给client之前;保存进数据库之前。

和action不同,需要一个内容参数:

 1 <?php
 2 function cwmp_add_content_watermark( $content )
 3 {
 4     
 5     // in case we want to add to earlier versions
 6     if (  is_feed() )
 7     {
 8         return $content . 
 9         "Created by Falkon Productions, copyright  " . 
10         date("Y") . 
11         " all rights reserved.";
12     }
13     
14     return $content;
15 }
16 
17 add_filter("the_content","cwmp_add_content_watermark");
18 ?>

posted on 2012-08-30 22:41  kalintw  阅读(175)  评论(0)    收藏  举报

导航