Filter Post Title without affecting screen-reader-text
Let's consider this code:
add_filter('the_title', static function ($title) {
return $title. '-boom';
});
Works fine, and adds '-boom' near all the titles.
But, I also noticed that in some themes (Twenty Twenty, Twenty One and most likely many others) if a post contains the !--more--
tag, this also affect the continue reading button, see image attached
As you can see the span class screen reader text is also affected. Since I want to add some html close to the_title, this breaks the layout.
How to solve?