Browser: Chrome lastet
OS: Windows 11
I want to modifiy the excerpt via the native wp filter
And this seems not to work with the dynamic tag.
Hope for a solution soon.
Thanks
PS. The excerpt element does work, but not the dynamic tag.
Browser: Chrome lastet
OS: Windows 11
I want to modifiy the excerpt via the native wp filter
And this seems not to work with the dynamic tag.
Hope for a solution soon.
Thanks
PS. The excerpt element does work, but not the dynamic tag.
Hi,
Thanks so much for your report!
What exactly do you want to modify?
You can already limit the number of words, and keep the HTML formatting: Dynamic Data – Bricks Academy. Also, adding some, e.g., dots at the end works with something like this:
/**
* Filter the excerpt "read more" string.
*
* @param string $more "Read more" excerpt string.
* @return string (Maybe) modified "read more" excerpt string.
*/
function wpdocs_excerpt_more( $more ) {
return '...';
}
add_filter( 'excerpt_more', 'wpdocs_excerpt_more' );
Alternatively, instead of {post_excerpt} you could use {echo:the_excerpt} and see if that works.
Best regards,
timmse
Hi Timmse
Thx for your reply.
Well, my modifications are quite big, also involving other custom field values etc.
Using the wp filter is just handy, so all my changes are reflecting in the native excerpt function and IMO this should reflect also in the Bricks dd tag.
But I can also use a custom function to get my desired values, no problem.
Thanks and regards
François
Hey @goninski,
you might be able to use the wp_trim_excerpt hook:
add_filter( 'wp_trim_excerpt', function( $text, $raw_excerpt ) {
// Do whatever you want here
return $text;
}, 10, 2 );
Let me know if that helps.
Best,
André
I’ve almost accomplished what I wanted with using get_the_excerpt hook instead of the_excerpt in combination with wp_trim_excerpt. It’s still not 100% working but I need to study more on all these various filters. For now I can do it with my own function without the filters.
Thanks to all for the hints.