the_content_rss

Display the post content for the feed.

Description

the_content_rss( $more_link_text = '( more... )', (int) $stripteaser = 0, (string) $more_file = '', (int) $cut = 0, (int) $encode_html = 0 ); 

For encoding the html or the $encode_html parameter, there are three possible values. 0 will make urls footnotes and use make_url_footnote(). 1 will encode special characters and automatically display all of the content. The value of 2 will strip all HTML tags from the content.

Also note that you cannot set the amount of words and not set the html encoding. If that is the case, then the html encoding will default to 2, which will strip all HTML tags.

To restrict the amount of words of the content, you can use the cut parameter. If the content is less than the amount, then there won't be any dots added to the end. If there is content left over, then dots will be added and the rest of the content will be removed.

Parameters (5)

0. $more_link_text — Optional. (string) => '(more...)'
Text to display when more content is available but not displayed.
1. $stripteaser — Optional. (int)
Default is 0.
2. $more_file — Optional. (string) => ''
The more file.
3. $cut — Optional. (int)
Amount of words to keep for the content.
4. $encode_html — Optional. (int)
How to encode the content.

Usage

  1. if ( !function_exists( 'the_content_rss' ) ) { 
  2. require_once ABSPATH . WPINC . '/deprecated.php'; 
  3.  
  4. // Optional. Text to display when more content is available but not displayed. 
  5. $more_link_text = '(more...)'; 
  6.  
  7. // Optional. Default is 0. 
  8. $stripteaser = -1; 
  9.  
  10. // The more file. 
  11. $more_file = ''; 
  12.  
  13. // Optional. Amount of words to keep for the content. 
  14. $cut = -1; 
  15.  
  16. // Optional. How to encode the content. 
  17. $encode_html = -1; 
  18.  
  19. // NOTICE! Understand what this does before running. 
  20. $result = the_content_rss($more_link_text, $stripteaser, $more_file, $cut, $encode_html); 
  21.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/deprecated.php  
  1. function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) { 
  2. _deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed' ); 
  3. $content = get_the_content($more_link_text, $stripteaser); 
  4. $content = apply_filters('the_content_rss', $content); 
  5. if ( $cut && !$encode_html ) 
  6. $encode_html = 2; 
  7. if ( 1== $encode_html ) { 
  8. $content = esc_html($content); 
  9. $cut = 0; 
  10. } elseif ( 0 == $encode_html ) { 
  11. $content = make_url_footnote($content); 
  12. } elseif ( 2 == $encode_html ) { 
  13. $content = strip_tags($content); 
  14. if ( $cut ) { 
  15. $blah = explode(' ', $content); 
  16. if ( count($blah) > $cut ) { 
  17. $k = $cut; 
  18. $use_dotdotdot = 1; 
  19. } else { 
  20. $k = count($blah); 
  21. $use_dotdotdot = 0; 
  22.  
  23. /** @todo Check performance, might be faster to use array slice instead. */ 
  24. for ( $i=0; $i<$k; $i++ ) 
  25. $excerpt .= $blah[$i].' '; 
  26. $excerpt .= ($use_dotdotdot) ? '...' : ''; 
  27. $content = $excerpt; 
  28. $content = str_replace(']]>', ']]>', $content); 
  29. echo $content;