源码
更新日志
版本 | 描述 |
---|---|
0.71 | 开始引入 |
使用示例
实例
要创建在URL(例如
http://www.example.com/?feed=myfeed&type=excerpt
)上接受GET参数的自定义feed,请在特定feed文件中放置以下内容,以发送摘录(the_excerpt_rss()),而不是完整内容(the_content()
):if isset( $_GET['type'] ) ) { $typewanted = sanitize_text_field( $_GET['type'] ); } if ( $typewantd == 'excerpt' ) { // Wrap the Excerpt in a span tag for CSS styling echo '<span class="excerpt">'; the_excerpt_rss(); echo '</span>'; } else { // Otherwise they want the full content so wrap it in another span echo '<span class="content">'; the_content(); echo '</span>'; }