Site logo

Archived topic

Screen reader element inserting into the read more button, affecting RSS

10 replies · Started by eraserheader on November 21, 2018

Viewing posts 1–11 of 11

Hi there goodness I love GeneratrePress!

I overhauled a site where the only big difference was switch to GeneratePress (with child theme) and new Ad manager plugin, but the RSS feed is spitting out a lot of extra content.

Did some digging and it looks like "screen-reader-text" element is being inserted into the "read more" button?

This is the markup I think is causing the problem:

<p class="read-more-container">
Read more
<span class="screen-reader-text">PostTitle</span>

</p>

And this is what RSS feeds are displaying (I've bolded where the feed would normally end, to show all the extra it's generating (filler text because I don't want to come across as spammy):

Let's Pretend This Is The Post Title
Nov 01, 2018 08:37 am - This is the excerpt that the site generates so that we have a snazzy and short blogroll ...
Read moreLet's Pretend This Is The Post Title (link of post) This is the excerpt that the site generates so that we have a snazzy and short blogroll ... (link of post) appeared first on SiteName (site url).

Thought it was Yoast doing this but the RSS fields are nice and blank, so that's not the culprit.

It's like it generates the screen-reader content somehow?

Thanks for the prompt reply, and apologies I didn't see this in my forum search to avoid pestering you. I'll let you know how I fare!

No problem! I actually think it was brought to my attention via email :)

Almost there!

The RSS is still displaying "readmore" and the link again. So looking for it to not display anything else after bolded text:

This Is Our Post Title For Example Purposes (which is already a clickable link)
Nov 22, 2018 02:56 pm - This is our snazzy excerpt GeneratePress is the best, as we all know...
Read more (This Is Our Post Title For Example Purposes (which is already a clickable link))

Could that end part be removed:

a) via a tweak to the filter (if so, I welcome any suggestions as PHP isn't my forte)

or

b) could be resolved in I removed the "read more" button option through the customizer (since the homepage is a blogroll). If so, is the best practice to take out that original filter?

I appreciate all your insight.

Hi there,

So that code above didn't remove the title after the "Read more" link at all?

This is how you'd remove the read more link as well:

add_filter( 'generate_excerpt_more_output', function( $more ) {
	if ( is_feed() ) {
		return '';
	}

	return $more;
} );

add_filter( 'the_content_more_link', function( $more ) {
	if ( is_feed() ) {
		return '';
	}

	return $more;
} );

That did the trick! Thanks so much and have a great week!

Thanks! You too :)

Aha, brilliant! A client was having issues with a MailChimp RSS Campaign where it uses the item 'description' element of the feed. It too was getting the extra 'continue reading/read more' links outputted which didn't look great in the emails.

But your second 'empty' code did the trick Tom!

Awesome! Thanks for confirming :)

Just a clarification for anyone else finding this thread in the archive:

Using just one of either of the two PHP snippets that Tom provides won't do anything, but if you add both of them to your instance (e.g., using the Code Snippets plugin), then the "Read More" and title copy will be removed after RSS posts in the feed.

Thanks for the continued amazing support, Tom!

This archived topic is closed to new replies.