Support » Plugin: Advanced Excerpt » Not working for pages with a custom loop

  • I’m working on some pages that have a custom loop to output recent posts.

    The notes say “you can start The Loop manually and apply the plugin as usual.”

    But looking at the code it looks like there’s no way to apply the plugin to pages (or posts) with a custom loop on them – because ‘singular’ page types are always excluded?

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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

    Thread Starter smartyp

    (@smartyp)

    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).

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.