Archived topic
Not consistent 'Read More'-texts in Dutch
11 replies · Started by Bas on March 11, 2021
In some blogposts, we want to use an custom excerpt. That particular posts do not show a Read More-button on the Blog-archive. No problem, we've found your code snippet to solve it (by the way: the first snippet returns an error on line 3!).
When we're using the normal Read More-tag in the Classic Editor, the button on the archive page shows the text 'Lees Meer', which is correct (and also set in the Customiser). But with the custom excerpt, it shows 'Meer lezen', which is not correct. How can we change that?
By the way, all my GP-website do not strip the HTML from the excerpt. Strange, since this should be a WP-default. It's happening on several sites, all with GP, on different servers. How can I strip the HTML in the excerpt?
Hi Bas,
You could try to change the php snippet a bit.
Change Read More to Lees Meer.
Let me know :)
Hi, that worked excellent, many thanks!
But I'm still curious how to strip the HTML in the excerpt.
Glad to hear that :)
As far as I know, keeping tags from excerpt is NOT by default in Wordpress, but you could use specific excerpt plugin to achieve it, something like this:
https://en-ca.wordpress.org/plugins/advanced-excerpt/
No, it's the other way around: all my websites with GeneratePress do not strip HTML in the excerpt by default. Very strange, but it's really the case. See https://imgur.com/TRHJnSX
Sorry I think there's some misunderstanding :)
So your issue is the formatting is kept in excerpt?
Can you link us to the site?
I've made a temporary admin account on of own websites facing the same problem. See the italic word in the first line in the first excerpt over here. The (bolder) font-weight in the excerpts is correct, that's set in the custom CSS.
I like the password :P
The excerpt keeps format because you are using More tag.
WP strips html for excerpt by default, but there're 2 ways to workaround.
1. Using more tag.
2. Using plugin.
Here's a similar question answered by David, just for your reference.
https://generatepress.com/forums/topic/no-bold-letters-outside-the-posts-in-archive-view/#post-1185578
So, after using WP for nearly a decade, I found out that WP doesn't strip HTML before the 'read more' tag. Okay.. But on a lot of client sites, the HTML is stripped. I guess that's hardcoded in the (custom) theme.
Anyway, I'll try that plugin. But I'm afraid that it won't just strip the HTML, unless I will allow it to generate the excerpt, which I do not want.
The plugin is to keep the html NOT to strip html since WP strip html by default.
You could use the custom excerpt field in post editor instead of the more tag to customize your excerpt.
https://www.screencast.com/t/C3OhgP84
For your reference, wordpress explained the read more tag here. The WP default is NOT strip html for the text before More tag. The article also includes a solution to change the default by making changes in index.php file.
https://codex.wordpress.org/Customizing_the_Read_More
Thanks, I'm asking this not behalf of myself, but for a non-techy person. I dont want to keep explaining when to use the custom excerpt, and when not. Meanwhile, I've found another workaround, by using the CSS to filter the effect of the HTML:
/* Strip bold in excerpts */
.home .entry-content p strong, .archive .entry-content p strong{font-weight:normal}
/* Strip italic in excerpts */
.home .entry-content p em, .archive .entry-content p em{font-style:normal}
/* Strip images in excerpts */
.home .entry-content p img, .archive .entry-content p img{display:none}
It's working fine, but not a great solution.
Sure, that'll do too :)