rss_use_excerpt is the option people can use to change the blog from Full Text
to Summary
. With a combination of is_front_page and that setting you can determine if you’re blog page is showing the summary — in your case — when you don’t want to show the banner on the blog page.
function display_banner($content)
{
return '<div class="banner">Banner</div>' . $content;
}
function display_content_banner($content)
{
// [ 0:NO, 1:YES ] - https://codex.wordpress.org/Option_Reference#Reading
static $rss_use_excerpt;
if( ! isset($rss_use_excerpt)) $rss_use_excerpt = get_option('rss_use_excerpt');
if(is_single() || (is_front_page() && ! $rss_use_excerpt)) {
return display_banner($content);
}
else {
return $content; //on the post list page, the_excerpt is in charge of displaying the banner.
}
}
add_filter('the_excerpt', 'display_banner');
add_filter('the_content', 'display_content_banner');