Plugin Author
WPKube
(@wpkube)
Did you write the code for the custom loop or is it some plugin you’re using?
If it’s code then you can use the function that the plugin comes with:
the_advanced_excerpt()
Just place it instead of the regular the_excerpt()
function
The code uses wp_get_recent_posts. But returned as an object, so the loop uses the_title(), get_the_excerpt() etc (without passing post ID) – all works fine.
If I switch out get_the_excerpt() for the_advanced_excerpt(), I just get the excerpt for the page and not the post object in the loop?
LATER: just tried switching out wp_get_recent_posts for WP_Query, and the_advanced_excerpt() now works as expected. Curious as to why it doesn’t work for wp_get_recent_posts though? 🙂
Plugin Author
WPKube
(@wpkube)
Hi @smartyp
Great, happy to hear it worked out.
If get_the_excerpt() returned the correct excerpt, then I’m not quite sure why it didn’t apply, what the function does is add a filter for “get_the_excerpt” and then calls either the_excerpt() or get_the_excerpt() (depending if it’s set to echo or return).