Ok, I think I have the answer, found on this page: https://www.relevanssi.com/knowledge-base/oceanwp/
“OceanWP does that (<use the_excerpt()>), but only for posts that have hand-made excerpts. If the post doesn’t have an excerpt, OceanWP uses
echo wp_trim_words( strip_shortcodes( $post->post_content ), $length );
I’ll try the solution given in this page (I already have a child theme) and let you know.
And here is the solution… In the OceanWP child folder, I’ve edited the functions.php file to add this at the end:
/**
* Override the oceanwp_excerpt() function by the standard the_excerpt()
*
* @link http://codex.ww.wp.xz.cn/Child_Themes
*/
function alternative_text_for_oceanwp_excerpt()
{
// Render for all posts
echo the_excerpt();
}
add_filter( 'oceanwp_excerpt', 'alternative_text_for_oceanwp_excerpt', 999 );
And here is the solution… In the OceanWP child folder, I’ve edited the functions.php file to add this at the end:
/**
* Override the oceanwp_excerpt() function by the standard the_excerpt()
*
* @link http://codex.ww.wp.xz.cn/Child_Themes
*/
function alternative_text_for_oceanwp_excerpt()
{
// Render for all posts
echo the_excerpt();
}
add_filter( 'oceanwp_excerpt', 'alternative_text_for_oceanwp_excerpt', 999 );
Plugin Author
WPKube
(@wpkube)
Hi @vuichard
Thanks for sharing the solution.
Since it’s add_filter then it’s expecting to return a content, not echo. The echo still executes at the point where the filter is called but it could cause issues.
Instead of echo the_excerpt() try return get_the_excerpt()
But I’m not too familiar with the theme so I’m not sure if that’ll work out, if it doesn’t let me know and I’ll take a closer look.
Thanks but I had already figured that out and fixed the code 😉
I had not posted the fix because I still have an issue: it works with articles, but static pages now start with an excerpt. I thought it was the “echo” that was causing it but apparently it’s something else. Still working on it…