Skip to content

Instantly share code, notes, and snippets.

@generatepress
Last active November 5, 2018 23:29
Show Gist options
  • Save generatepress/a5f0dfd0db3c1d7fc5b217e07203fc58 to your computer and use it in GitHub Desktop.
Save generatepress/a5f0dfd0db3c1d7fc5b217e07203fc58 to your computer and use it in GitHub Desktop.
Remove screen reader text from more link in the feed
add_filter( 'generate_excerpt_more_output', function( $more ) {
if ( is_feed() ) {
return sprintf( ' ... <a title="%1$s" class="read-more" href="%2$s">%3$s</a>',
the_title_attribute( 'echo=0' ),
esc_url( get_permalink( get_the_ID() ) ),
__( 'Read more', 'generatepress' )
);
}
return $more;
} );
add_filter( 'the_content_more_link', function( $more ) {
if ( is_feed() ) {
return sprintf( '<p class="read-more-container"><a title="%1$s" class="read-more content-read-more" href="%2$s">%3$s</a></p>',
the_title_attribute( 'echo=0' ),
esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump','#more-' . get_the_ID() ) ),
__( 'Read more', 'generatepress' )
);
}
return $more;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment