WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Use excerpt of 150 words in RSS feed, exclude certain posts (1 post)

  1. FofR
    Member
    Posted 5 years ago #

    I would like to provide my blog feed as an official source to a particular site's news website, however one of their requirements is that the average post excerpt length in the RSS feed is 100 words.

    Currently WordPress defaults to an excerpt that is shorter than this, about 50 words. I'd also like to exclude posts that do not have content greater than 150 words, ensuring that I am only ever passing significant content to the news website, once again as per their Ts & Cs.

    I've looked around for a solution and haven't turned up many results. I have found a way to change the default excerpt length within a theme here: http://wordpress.org/support/topic/231953?replies=6 but I cannot apply that to the RSS.

    EDIT: That did work - adding this to the functions.php in the theme:

    add_filter('excerpt_length', 'my_excerpt_length');
    function my_excerpt_length($length) {
    return 20; // Or whatever you want the length to be.
    }

    To achieve the exclusion of posts I plan to use a dirty method of placing small posts into a category, hiding that category from listings and excluding it from the feed I provide to the news site. This isn't very full proof for other contributors though. An automated method would be superior.

Topic Closed

This topic has been closed to new replies.

About this Topic