You can select between Full text
and Summary
in the Reading settings:
If you select the Summary
, then
a) To control the number of words in the feed summary you can use:
add_filter('excerpt_length','custom_excerpt_length');
function custom_excerpt_length( $num_words ){
return 30; // number of words to show
}
The default number of words in the summary is 55
.
b) If you want to use <!--more-->
in the post content to define the feed summary, you can use the following:
add_filter( 'the_content', 'custom_content_feed' );
function custom_content_feed( $content ){
if( is_feed() ){
// <!--more--> used in the post content:
if( strpos( $content, '<span id="more-') !== FALSE ){
// remove the excerpt length limit
add_filter( 'excerpt_length', 'custom_long_excerpt_length' );
// get the content before <!--more-->
$content = stristr( $content, '<span id="more-', TRUE );
// add the default 'read more' symbols at the end:
$excerpt_more = apply_filters( 'excerpt_more', ' ' . '[…]' );
$content .= $excerpt_more;
}
}
return $content;
}
function custom_long_excerpt_length( $num_words ){
return 99999;
}
c) You can also use a) and b) together.