
如何修复MAMP本地环境phpMyAdmin不工作错误
the_content_rss ( $more_link_text = '(more...)', $stripteaser = 0, $more_file = '', $cut = 0, $encode_html = 0 )
the_content_rss – 这个函数用于在RSS feed中显示一个文章或页面的内容。它与the_content_feed类似,但输出结果略有不同。
显示feed的文章内容。
对于HTML的编码或$encode_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<$k; $i++ ) $excerpt .= $blah[$i].' '; $excerpt .= ($use_dotdotdot) ? '...' : ''; $content = $excerpt; } $content = str_replace(']]>', ']]>', $content); echo $content; }