the_content_rss
函数
      the_content_rss ( $more_link_text = '(more...)', $stripteaser = 0, $more_file = '', $cut = 0, $encode_html = 0 )    
  - 参数
 - 
- 
                (string)
$more_link_text
Optional. Text to display when more content is available but not displayed. Default ‘(more…)’.- Required: 否
 - Default: ‘(more…)’
 
 - 
                (int)
$stripteaser
Optional. Default 0.- Required: 否
 
 - 
                (string)
$more_file
Optional.- Required: 否
 - Default: (empty)
 
 - 
                (int)
$cut
Optional. Amount of words to keep for the content.- Required: 否
 
 - 
                (int)
$encode_html
Optional. How to encode the content.- Required: 否
 
 
 - 
                (string)
 
- 相关
 - 
- the_content_feed()
 
 
- 定义位置
 - 
- 
                                  wp-includes/deprecated.php
, line 1678 
 - 
                                  wp-includes/deprecated.php
 
- 引入
 - 0.71
 
- 弃用
 - 2.9.0
 
显示feed的文章内容。
对于HTML的编码或$encode_html参数,有三种可能的值。
- – 0’将使urls成为脚注并使用make_url_footnote()。
 - – 1’将对特殊字符进行编码,并自动显示所有的内容。
 - – 2’将从内容中剥离所有HTML标签。
 
还要注意,你不能设置字数而不设置HTML编码。如果是这样的话,那么HTML编码将默认为2,这将剥离所有的HTML标签。
为了限制内容的字数,你可以使用切割参数。如果内容少于这个数量,那么就不会有任何点加在结尾。如果有剩余的内容,那么将添加圆点,其余的内容将被删除。
function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
	_deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed()' );
	$content = get_the_content($more_link_text, $stripteaser);
	/**
	 * Filters the post content in the context of an RSS feed.
	 *
	 * @since 0.71
	 *
	 * @param string $content Content of the current post.
	 */
	$content = apply_filters('the_content_rss', $content);
	if ( $cut && !$encode_html )
		$encode_html = 2;
	if ( 1== $encode_html ) {
		$content = esc_html($content);
		$cut = 0;
	} elseif ( 0 == $encode_html ) {
		$content = make_url_footnote($content);
	} elseif ( 2 == $encode_html ) {
		$content = strip_tags($content);
	}
	if ( $cut ) {
		$blah = explode(' ', $content);
		if ( count($blah) > $cut ) {
			$k = $cut;
			$use_dotdotdot = 1;
		} else {
			$k = count($blah);
			$use_dotdotdot = 0;
		}
		/** @todo Check performance, might be faster to use array slice instead. */
		for ( $i=0; $i', ']]>', $content);
	echo $content;
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。