0

I use a static page (Blog) to display the latest posts. I want to show the excerpt of that page next to the title. However, wen I use wp_kses_post( get_the_excerpt() ), I get the excerpt of the latest post from the post archive loop. I also tried with wp_kses_post( get_the_archive_description() ) but it also does not seem to work.. Any idea how this can be done?

1

You can use get_queried_object() to get the static page data, and then do something like so to get the excerpt of the page:

echo get_the_excerpt( get_queried_object() );

// Or to apply filters just as the_excerpt() does:
$excerpt = get_the_excerpt( get_queried_object() );
echo apply_filters( 'the_excerpt', $excerpt );
1
  • 1
    Awesome, this is working like a charm! Thank you! – Badan Mar 30 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.