문제

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?

도움이 되었습니까?

해결책

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 );
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 wordpress.stackexchange
scroll top