wordpress 加载慢_如何在WordPress中轻松添加视频的延迟加载

在网站上嵌入视频虽然能提高用户参与度,但也会导致加载速度变慢。通过使用视频延迟加载技术,可以显著提高页面速度。视频延迟加载将YouTube和Vimeo视频替换为可点击的预览图像,只有当用户点击时才会加载和播放视频。通过安装并激活'Lazy Load for Videos'插件,可以在WordPress中轻松实现这一功能,同时还可以进行自定义设置以优化视频缩略图的外观和行为。
摘要由CSDN通过智能技术生成

wordpress 加载慢

Videos are great for improving user engagement on your website. However, one downside of embedding videos is that it slows down your website. In this article, we will show you how to add lazy loading for videos in WordPress and improve your page speed.

视频非常适合提高网站上的用户参与度。 但是, 嵌入视频的一个缺点是它会降低您的网站速度。 在本文中,我们将向您展示如何为WordPress中的视频添加延迟加载并提高页面速度。

视频的延迟加载如何工作? (How does Lazy Loading for Videos Work?)

Lazy Loading for Videos

Wondering what exactly is lazy loading, and how does it work?

想知道延迟加载到底是什么,它是如何工作的?

When you embed a video on your site, you add additional external scripts and files that needs to be loaded. Since there is more to load, your website loads slower.

将视频嵌入网站时,会添加其他需要加载的外部脚本和文件。 由于加载的内容更多,因此您的网站加载速度较慢。

Video lazy loading replaces the embedded Youtube and Vimeo videos with a clickable preview image. When your visitors click on the image, it loads and play the video.

视频延迟加载将可点击的预览图像替换为嵌入式Youtube和Vimeo视频。 当您的访客单击图像时,它将加载并播放视频。

Since images are a lot smaller in size than videos, the lazy loading technique significantly improve page speed.

由于图像的大小比视频小得多,因此延迟加载技术可以显着提高页面速度。

Now that you know the advantages, let’s take a look at how to lazy load YouTube and Vimeo videos in WordPress.

现在您已经知道了优点,让我们看一下如何在WordPress中延迟加载YouTube和Vimeo视频。

影片教学 (Video Tutorial)

演示地址

If you don’t like the video or need more instructions, then continue reading.

如果您不喜欢该视频或需要更多说明,请继续阅读。

如何在WordPress中为视频添加延迟加载 (How to Add Lazy Loading for Videos in WordPress)

First thing you need to do is install and activate the Lazy Load for Videos plugin.

您需要做的第一件事是安装并激活“ 视频延迟加载”插件。

This plugin works out of the box, and you do not need to edit any lazy loading jQuery scripts or any code for that matter.

该插件开箱即用,您无需为此而编辑任何延迟加载的jQuery脚本或任何代码。

To see that your lazy loading is working, all you need to do is view a post or page that contains a YouTube or Vimeo video. You will notice that the default players are replaced by a video thumbnail and a play button.

要查看您的延迟加载是否有效,您所需要做的就是查看包含YouTube或Vimeo视频的帖子或页面。 您会注意到默认的播放器已被视频缩略图和播放按钮取代。

A lazy load video with thumbnail and play button

When you click on the image, it will load the video and play it.

当您单击图像时,它将加载视频并播放。

There might be a slight second (negligible) delay in loading the video, so please don’t think that the lazy loading is not working.

加载视频可能会延迟一秒钟(可以忽略不计),因此请不要认为延迟加载无法正常工作。

Even though this plugin works out of the box, there are still settings which you can configure based on your needs.

即使此插件开箱即用,仍然可以根据需要配置一些设置。

On the post editor screen, you can choose the thumbnail quality for YouTube video embeds.

在帖子编辑器屏幕上,您可以选择YouTube视频嵌入的缩略图质量。

Controlling YouTube thumbnail  quality for posts and pages

Aside from the thumbnail quality, there are further customization options available if you head over to Settings » Lazy Load for Videos.

除了缩略图质量之外,如果您转到设置»视频的延迟加载 ,则还有其他自定义选项可用。

Settings page for lazy load for videos WordPress plugin

On the general settings tab, you can customize the appearance of the video thumbnails. You can enable responsive mode, choose play button style, use custom CSS, and even enable schema.org markup.

在常规设置选项卡上,您可以自定义视频缩略图的外观。 您可以启用响应模式,选择播放按钮样式,使用自定义CSS,甚至启用schema.org标记。

This plugin supports both YouTube and Vimeo. You can find provider specific settings by clicking on the respective tabs.

此插件支持YouTube和Vimeo。 您可以通过单击相应选项卡找到提供商特定的设置。

On the YouTube tab, you can choose colors, thumbnail quality, disable related videos and annotations, etc. You can even disable lazy load for YouTube videos.

在YouTube标签上,您可以选择颜色,缩略图质量,禁用相关视频和注释等。甚至可以禁用YouTube视频的延迟加载。

Lazy load for YouTube settings

Similarly, on the Vimeo settings tab you can choose control colors, hide or display video title, and disable lazy load for Vimeo videos.

同样,在Vimeo设置选项卡上,您可以选择控制颜色,隐藏或显示视频标题以及禁用Vimeo视频的延迟加载。

Lazy load for Vimeo

That’s all. We hope this article helped you add lazy load for videos in WordPress.

就这样。 我们希望本文能帮助您为WordPress中的视频添加延迟加载。

To further boost your website’s speed you will need to setup a WordPress CDN solution with W3 Total Cache plugin.

为了进一步提高网站速度,您将需要使用W3 Total Cache插件设置WordPress CDN解决方案

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Google+.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterGoogle+上找到我们。

翻译自: https://www.wpbeginner.com/plugins/how-to-easily-add-lazy-loading-for-videos-in-wordpress/

wordpress 加载慢

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值