Archived topic
Blog archives showing all content instead of excerpt using Video post format
5 replies · Started by Pascal on September 20, 2019
Hi there, I'm trying to set my blog archive pages in order to show a YouTube video and an excerpt of the post content. I've selected Video post format but my blog archives are showing all content beneath the video instead of only the post excerpt. Do you have any solution for this?
Thanks in advance 4 your help!
Pascal
HERE A SCREENSHOT » https://imgur.com/a/7PuR9iX
Hi there,
try adding this PHP snippet:
add_filter( 'generate_show_excerpt', function( $show ) {
if ( 'video' === get_post_format() ) {
$show = true;
}
return $show;
} );
Hi David, thanks 4 the snippet! It works great but it hides also the featured video. Is there a way to keep the featured video and make it appear instead of the featured image in blog archives?
Thanks again for your help!
Pascal
Oops - i didn't look close enough to see you had the video in post content.
So excerpts are stripped of HTML by default in WordPress.
Two choices:
1. Use the Read More tag in your post:
https://docs.generatepress.com/article/using-the-more-tag/
2. The Advanced Excerpts plugin in the WordPress repository
Thanks David! The "Read more" solution works perfectly! :)
Glad to be of help