Hi there,
I’m creating a ‘video’ blog post and i’m pasting the link to the video in the beginning of the post.
The problem is, the link shows up in the preview text of the post, which impacts readability. Is there any way to fix that please?
Many thanks
Anya
Hey annajou,
One option is to manually change the excerpt by using the excerpt field below each post, this allows you to set the excerpt you wish to show. To use this option go to a post, and at the top of the page click “Screen Options” and choose the “Excerpt” box.
In my testing, adding the embed iframe link from Youtube does not show in the excepts on the blog page, nor does using the video element within the builder. How are you adding the videos?
Another option is to add this code to the end of your functions.php file in Appearance > Editor:
add_filter('wpv_filter_post_excerpt', 'remove_youtubelinks_func');
function remove_youtubelinks_func($excerpt){
return $excerpt = preg_replace('~(?:http|https|)(?::\/\/|)(?:www.|)(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[a-z0-9;:@?&%=+\/\$_.-]*~i', '', $excerpt);
}
Best regards,
Mike
Hi @Mike,
Thanks for the quick reply!
I am just pasting the link into the type field, and it turns into a youtube video. So, I don’t see the text link int he actual post. But in the preview, it shows as text. Maybe I am embedding it wrong?
I will try your suggestions above!