0

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 :)

2

1 Answer 1

3

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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