当前浏览:首页 / WordPress函数 / the_excerpt_rss()

the_excerpt_rss()

显示feed的文章摘录

excerpt 摘要more...

rss

themore...



源码

查看源码 官方文档


更新日志

版本描述
0.71开始引入

使用示例

  • 示例1

    实例

    要创建在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>';
    }