Skip to content

Instantly share code, notes, and snippets.

@sarahmonster
Created September 29, 2016 08:34
Show Gist options
  • Save sarahmonster/c930490ebfd4953b9a7f23f5972c89e5 to your computer and use it in GitHub Desktop.
Save sarahmonster/c930490ebfd4953b9a7f23f5972c89e5 to your computer and use it in GitHub Desktop.
This allows for breaking of post content in feeds at the more tag, rather than relying on the excerpt.
<?php
/**
* Customise feed output.
*
* @package Themename
*/
/*
* Break feed content at the <!--more--> tag.
* "For each article in a feed, show" should be set to "full text" for this to work properly.
*/
function themeslug_content_feed( $feed_type = null ) {
if ( !$feed_type ) {
$feed_type = get_default_feed();
}
global $more;
$more_restore = $more;
$more = 0;
$content = apply_filters( 'the_content', get_the_content() );
$more = $more_restore;
$content = str_replace( ']]>', ']]& gt;', $content );
return $content;
}
add_filter( 'the_content_feed', 'themeslug_content_feed' );
add_filter( 'the_excerpt_rss', 'themeslug_content_feed' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment