Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Currently, my RSS feeds show the entire text from main text field.

I only want to show parts of my text, preferrably my intro text, so that users have to visit my page to read the rest.

I've customized my WP to act more as an CMS. Among the things I've done, is to remove the Excerpt field with remove_meta_box('postexcerpt', 'post', 'normal').

Then I've added my own meta boxes for intro text (excerpt) and short intro text.

Because of this, my intro text is not shown and I'm not using the_excerpt_rss().

This is the code I use to show my intro text:

function the_intro($attr = null) {
  $intro = get_intro($attr);
  echo $intro;
}

Where the function get_intro($attr); is a bigger function to actually retrieve and return intro text.

Looking at wp-include/feed.php, I see they use this:

echo apply_filters('bloginfo_rss', get_bloginfo_rss($show), $show);

Should I add this filter to my custom functions?

I have not tested yet, just in case I break something :)

share|improve this question
    
Nice question for my Enhancing Feeds Series - hakre.wordpress.com/category/plugin-plugout/enhancing-feeds –  hakre Jan 6 '11 at 15:48
    
Ah, nice :) I'll have a read after dinner. –  Steven Jan 6 '11 at 16:27
add comment

1 Answer

wp-rss2.php is deprecated. Feeds are currently generated by special templates in wp-includes folder, namely feed-rss2.php for RSS 2.0. Of course they shouldn't be edited just as well, only mentioning this for context of where you need to look for template details.

the_excerpt_rss() function passes it's output through filter of same name the_excerpt_rss. You can use this filter to replace native excerpt with whatever you want.

add_filter( 'the_excerpt_rss', 'custom_excerpt_rss' );

function custom_excerpt_rss( $output ) {

    return 'something to replace excerpt with';
}

Also I am not sure from your description if your feed is set to show excerpts in Settings > Reading. Depending on that you might need to use the_content_feed filter instead.

share|improve this answer
    
ah, thanks. I will test this later on. –  Steven Jan 6 '11 at 16:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.