6 reworded some sentances to improve clarity, added detail
source | link

My approach would be to:

  1. SetOn the default RSS optionsReading Options page, set the For each article in a feed, show... option to showFull Text so that, by default, feeds will include the full contententire post.
  2. Pass a custom URL parameter to each individual feed when you only want the excerpt instead of the full text. e.g., http://example.com/author/username/feed?format=excerpt. Make sure you don't use a reserved term for the parameter name.
  3. Hook into the RSSfeed creation process and check ifmodify the content based on whether or not the custom parameter is present in the current feed's URL.
  4. If it is present, override the feed's content to only display the excerpt instead of the URLfull text.
  5. When you want the full content, just use the regular URL. e.g., http://example.com/author/username/feed.

Here's some code that does that, using format as the parameter name. PutYou can use any parameter name you want, as long as you update each part of the code that references it. Put the code inside a functionality plugin.

function truncateFeedContent( $content )
{
    if( get_query_var( 'format' ) == 'excerpt' )
    {
        $content = get_the_excerpt();
        $content = apply_filters( 'the_excerpt_rss', $content );
    }

    return $content;
}
add_filter( 'the_content_feed', 'truncateFeedContent' );

function addFormatQueryVar( $queryVars )
{
    $queryVars[] = 'format';

    return $queryVars;
}
add_filter( 'query_vars', 'addFormatQueryVar' );

To avoid a conflict with the Advanced Excerpt plugin, add this code to the functionality plugin as well. It will disable Advanced Excerpt's functionality on feed URLs, but leave it in tact for all other pages.

function stopAdvancedExcerptOnFeeds()
{
    if( is_feed() )
        remove_filter( 'get_the_excerpt', array( 'AdvancedExcerpt', 'filter' ) );
}
add_action( 'pre_get_posts', 'stopAdvancedExcerptOnFeeds' );

My approach would be to:

  1. Set the default RSS options to show the full content.
  2. Pass a custom URL parameter to each feed when you only want the excerpt. e.g., http://example.com/author/username/feed?format=excerpt. Make sure you don't use a reserved term.
  3. Hook into the RSS creation process and check if the custom parameter is present in the current URL.
  4. If it is, display the excerpt instead of the URL.
  5. When you want the full content, just use the regular URL. e.g., http://example.com/author/username/feed.

Here's some code that does that. Put it inside a functionality plugin.

function truncateFeedContent( $content )
{
    if( get_query_var( 'format' ) == 'excerpt' )
    {
        $content = get_the_excerpt();
        $content = apply_filters( 'the_excerpt_rss', $content );
    }

    return $content;
}
add_filter( 'the_content_feed', 'truncateFeedContent' );

function addFormatQueryVar( $queryVars )
{
    $queryVars[] = 'format';

    return $queryVars;
}
add_filter( 'query_vars', 'addFormatQueryVar' );

To avoid a conflict with the Advanced Excerpt plugin, add this code to the functionality plugin as well. It will disable Advanced Excerpt's functionality on feed URLs, but leave it in tact for all other pages.

function stopAdvancedExcerptOnFeeds()
{
    if( is_feed() )
        remove_filter( 'get_the_excerpt', array( 'AdvancedExcerpt', 'filter' ) );
}
add_action( 'pre_get_posts', 'stopAdvancedExcerptOnFeeds' );

My approach would be to:

  1. On the Reading Options page, set the For each article in a feed, show... option to Full Text so that, by default, feeds will include the entire post.
  2. Pass a custom URL parameter to each individual feed when you want the excerpt instead of the full text. e.g., http://example.com/author/username/feed?format=excerpt. Make sure you don't use a reserved term for the parameter name.
  3. Hook into the feed creation process and modify the content based on whether or not the custom parameter is present in the current feed's URL.
  4. If it is present, override the feed's content to only display the excerpt instead of the full text.
  5. When you want the full content, just use the regular URL. e.g., http://example.com/author/username/feed.

Here's some code that does that, using format as the parameter name. You can use any parameter name you want, as long as you update each part of the code that references it. Put the code inside a functionality plugin.

function truncateFeedContent( $content )
{
    if( get_query_var( 'format' ) == 'excerpt' )
    {
        $content = get_the_excerpt();
        $content = apply_filters( 'the_excerpt_rss', $content );
    }

    return $content;
}
add_filter( 'the_content_feed', 'truncateFeedContent' );

function addFormatQueryVar( $queryVars )
{
    $queryVars[] = 'format';

    return $queryVars;
}
add_filter( 'query_vars', 'addFormatQueryVar' );

To avoid a conflict with the Advanced Excerpt plugin, add this code to the functionality plugin as well. It will disable Advanced Excerpt's functionality on feed URLs, but leave it in tact for all other pages.

function stopAdvancedExcerptOnFeeds()
{
    if( is_feed() )
        remove_filter( 'get_the_excerpt', array( 'AdvancedExcerpt', 'filter' ) );
}
add_action( 'pre_get_posts', 'stopAdvancedExcerptOnFeeds' );
5 added code to fix conflict with Advanced Excerpt
source | link

My approach would be to:

  1. Set the default RSS options to show the full content.
  2. Pass a custom URL parameter to each feed when you only want the excerpt. e.g., http://example.com/author/username/feed?format=excerpt. Make sure you don't use a reserved term.
  3. Hook into the RSS creation process and check if the custom parameter is present in the current URL.
  4. If it is, display the excerpt instead of the URL.
  5. When you want the full content, just use the regular URL. e.g., http://example.com/author/username/feed.

Here's some code that does that. Put it inside a functionality plugin.

function truncateFeedContent( $content )
{
    if( get_query_var( 'format' ) == 'excerpt' )
    {
        $content = get_the_excerpt();
        $content = apply_filters( 'the_excerpt_rss', $content );
    }

    return $content;
}
add_filter( 'the_content_feed', 'truncateFeedContent' );

function addFormatQueryVar( $queryVars )
{
    $queryVars[] = 'format';

    return $queryVars;
}
add_filter( 'query_vars', 'addFormatQueryVar' );

To avoid a conflict with the Advanced Excerpt plugin, add this code to the functionality plugin as well. It will disable Advanced Excerpt's functionality on feed URLs, but leave it in tact for all other pages.

function stopAdvancedExcerptOnFeeds()
{
    if( is_feed() )
        remove_filter( 'get_the_excerpt', array( 'AdvancedExcerpt', 'filter' ) );
}
add_action( 'pre_get_posts', 'stopAdvancedExcerptOnFeeds' );

My approach would be to:

  1. Set the default RSS options to show the full content.
  2. Pass a custom URL parameter to each feed when you only want the excerpt. e.g., http://example.com/author/username/feed?format=excerpt. Make sure you don't use a reserved term.
  3. Hook into the RSS creation process and check if the custom parameter is present in the current URL.
  4. If it is, display the excerpt instead of the URL.
  5. When you want the full content, just use the regular URL. e.g., http://example.com/author/username/feed.

Here's some code that does that. Put it inside a functionality plugin.

function truncateFeedContent( $content )
{
    if( get_query_var( 'format' ) == 'excerpt' )
    {
        $content = get_the_excerpt();
        $content = apply_filters( 'the_excerpt_rss', $content );
    }

    return $content;
}
add_filter( 'the_content_feed', 'truncateFeedContent' );

function addFormatQueryVar( $queryVars )
{
    $queryVars[] = 'format';

    return $queryVars;
}
add_filter( 'query_vars', 'addFormatQueryVar' );

My approach would be to:

  1. Set the default RSS options to show the full content.
  2. Pass a custom URL parameter to each feed when you only want the excerpt. e.g., http://example.com/author/username/feed?format=excerpt. Make sure you don't use a reserved term.
  3. Hook into the RSS creation process and check if the custom parameter is present in the current URL.
  4. If it is, display the excerpt instead of the URL.
  5. When you want the full content, just use the regular URL. e.g., http://example.com/author/username/feed.

Here's some code that does that. Put it inside a functionality plugin.

function truncateFeedContent( $content )
{
    if( get_query_var( 'format' ) == 'excerpt' )
    {
        $content = get_the_excerpt();
        $content = apply_filters( 'the_excerpt_rss', $content );
    }

    return $content;
}
add_filter( 'the_content_feed', 'truncateFeedContent' );

function addFormatQueryVar( $queryVars )
{
    $queryVars[] = 'format';

    return $queryVars;
}
add_filter( 'query_vars', 'addFormatQueryVar' );

To avoid a conflict with the Advanced Excerpt plugin, add this code to the functionality plugin as well. It will disable Advanced Excerpt's functionality on feed URLs, but leave it in tact for all other pages.

function stopAdvancedExcerptOnFeeds()
{
    if( is_feed() )
        remove_filter( 'get_the_excerpt', array( 'AdvancedExcerpt', 'filter' ) );
}
add_action( 'pre_get_posts', 'stopAdvancedExcerptOnFeeds' );
4 i tested code and it works, so i removed the note about author needing to tweak
source | link

My approach would be to:

  1. Set the default RSS options to show the full content.
  2. Pass a custom URL parameter to each feed when you only want the excerpt. e.g., http://example.com/author/username/feed?format=excerpt. Make sure you don't use a reserved term.
  3. Hook into the RSS creation process and check if the custom parameter is present in the current URL.
  4. If it is, display the excerpt instead of the URL.
  5. When you want the full content, just use the regular URL. e.g., http://example.com/author/username/feed.

So, theHere's some code would look something like thisthat does that. Put it inside a functionality plugin.

function truncateFeedContent( $content )
{
    if( get_query_var( 'format' ) == 'excerpt' )
    {
        $content = get_the_excerpt();
        $content = apply_filters( 'the_excerpt_rss', $content );
    }

    return $content;
}
add_filter( 'the_content_feed', 'truncateFeedContent' );

function addFormatQueryVar( $queryVars )
{
    $queryVars[] = 'format';

    return $queryVars;
}
add_filter( 'query_vars', 'addFormatQueryVar' );

I haven't tested that, so you may need to tweak it a bit, but that's the general idea.

My approach would be to:

  1. Set the default RSS options to show the full content.
  2. Pass a custom URL parameter to each feed when you only want the excerpt. e.g., http://example.com/author/username/feed?format=excerpt. Make sure you don't use a reserved term.
  3. Hook into the RSS creation process and check if the custom parameter is present in the current URL.
  4. If it is, display the excerpt instead of the URL.
  5. When you want the full content, just use the regular URL. e.g., http://example.com/author/username/feed.

So, the code would look something like this

function truncateFeedContent( $content )
{
    if( get_query_var( 'format' ) == 'excerpt' )
    {
        $content = get_the_excerpt();
        $content = apply_filters( 'the_excerpt_rss', $content );
    }

    return $content;
}
add_filter( 'the_content_feed', 'truncateFeedContent' );

function addFormatQueryVar( $queryVars )
{
    $queryVars[] = 'format';

    return $queryVars;
}
add_filter( 'query_vars', 'addFormatQueryVar' );

I haven't tested that, so you may need to tweak it a bit, but that's the general idea.

My approach would be to:

  1. Set the default RSS options to show the full content.
  2. Pass a custom URL parameter to each feed when you only want the excerpt. e.g., http://example.com/author/username/feed?format=excerpt. Make sure you don't use a reserved term.
  3. Hook into the RSS creation process and check if the custom parameter is present in the current URL.
  4. If it is, display the excerpt instead of the URL.
  5. When you want the full content, just use the regular URL. e.g., http://example.com/author/username/feed.

Here's some code that does that. Put it inside a functionality plugin.

function truncateFeedContent( $content )
{
    if( get_query_var( 'format' ) == 'excerpt' )
    {
        $content = get_the_excerpt();
        $content = apply_filters( 'the_excerpt_rss', $content );
    }

    return $content;
}
add_filter( 'the_content_feed', 'truncateFeedContent' );

function addFormatQueryVar( $queryVars )
{
    $queryVars[] = 'format';

    return $queryVars;
}
add_filter( 'query_vars', 'addFormatQueryVar' );
3 changed add_action to add_filter, switching to using query vars instead of $_GET directly
source | link
2 removed deprecated and duplicate filters, added `the_excerpt_rss` filter, removed unnecessary is_feed() call, renamed function
source | link
1
source | link