admin管理员组

文章数量:1297010

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?

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?

Share Improve this question asked Mar 30, 2021 at 7:53 BadanBadan 2251 silver badge7 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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 );

本文标签: archivesHow to Get The Excerpt of the page that displays Blog Posts