^ 回到顶部
  • 人生没有定律,每个人都有自己的节奏
  • 本站wordpress建站教程均通过实践后发布,希望对你有帮助,如果有代码出错,请联系站长解决
  • 希望你的坚持,都是因为热爱,而不是因为不甘心
  • 8年wordpress建站经验,5星服务品质
  • 那些不愿意让你吃亏的人,才是真正值得你深交的人,也是值得你付出时间的人
  • 阿里云2核2g仅需86元/年

wordpress函数the_excerpt_rss()用法示例

the_excerpt_rss()

Display the post excerpt for the feed.


描述


源代码

File: wp-includes/feed.php

新用户2核2g仅需86元/年    领取1153套模板    免费cdn流量包    ¥3188礼包

function the_excerpt_rss() {
	$output = get_the_excerpt();
	/**
	 * Filters the post excerpt for a feed.
	 *
	 * @since 1.2.0
	 *
	 * @param string $output The current post excerpt.
	 */
	echo apply_filters( 'the_excerpt_rss', $output );
}

更新日志

Version 描述
0.71 Introduced.

相关函数

Uses

  • wp-includes/plugin.php:
    apply_filters()
  • wp-includes/feed.php:
    the_excerpt_rss
  • wp-includes/post-template.php:
    get_the_excerpt()

  1. Skip to note content

    You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note

    Contributed by Codex

    Example

    To create a custom feed that takes a GET parameter on a URL (e.g. http://www.example.com/?feed=myfeed&type=excerpt), place something like the following in your particular feed file to send an excerpt (the_excerpt_rss()) instead of the full content (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>';
    }
    

让小雨知道,这篇文章帮到了你
扫码关注微信公众号zs40086(微搜片)随时随地微信看片,抢先福利电影等你来

热门推荐

如有疑问,请前往问答中心反馈!

反馈