如何在WordPress博客文章中轻松嵌入视频

Do you want to embed videos in your WordPress blog posts? Videos bring life to your website, and they are a great way to increase user engagement.

您是否要在WordPress博客文章中嵌入视频? 视频使您的网站栩栩如生,是增加用户参与度的好方法。

WordPress makes it super easy to embed videos from video hosting sites like YouTube, Vimeo, Facebook, Twitter, and many others.

WordPress使从YouTube,Vimeo,Facebook,Twitter等许多视频托管网站嵌入视频变得非常容易。

In this beginner’s guide, we will show you how to easily embed videos in WordPress blog posts, pages, and sidebar widgets.

在此初学者指南中,我们将向您展示如何轻松地将视频嵌入WordPress博客文章,页面和侧边栏小部件中。

How to easily embed videos in WordPress
如何在WordPress博客文章和页面中嵌入视频 (How to Embed Videos in WordPress Blog Posts and Pages)

WordPress comes with a great feature called auto-embeds which allows your website to automatically get the embed code from popular video hosting services like YouTube, Vimeo, etc.

WordPress具有一项称为自动嵌入的强大功能,该功能使您的网站可以从流行的视频托管服务(例如YouTube, Vimeo等)中自动获取嵌入代码。

All you need to do is paste the video URL into the WordPress editor.

您需要做的就是将视频URL粘贴到WordPress编辑器中

For example, you can copy the YouTube URL for a video that you want to embed.

例如,您可以复制要嵌入的视频的YouTube URL。

Next, edit the WordPress post or page where you want to add the video, and simply paste the URL in the content area.

接下来,编辑要在其中添加视频的WordPress帖子或页面,然后将URL粘贴到内容区域中即可。

Embedding video in WordPress post editor

As soon as you paste the video URL, WordPress will fetch the embed code and display the YouTube video inside the content editor.

粘贴视频URL后,WordPress将立即获取嵌入代码并在内容编辑器中显示YouTube视频。

You can now save your post and click on the preview button to see the embedded video in your blog post.

现在,您可以保存您的帖子,然后单击“预览”按钮以查看博客帖子中的嵌入式视频。

Video embedded in a WordPress blog post

Wasn’t that easy?

那不是那么容易吗?

After you have added the video, you can change its settings from the block toolbar and settings column on the right.

添加视频后,可以从右侧的块工具栏和“设置”列更改其设置。

Video block toolbar and settings

You can adjust the video width, make it full-width, change alignment, and more. You can also add a caption and preserve the video’s aspect ratio on mobile devices.

您可以调整视频宽度,使其变为全角,更改对齐方式等等。 您还可以添加标题并在移动设备上保留视频的长宽比。

WordPress can only do auto-embeds for white-listed video services. For other websites, you will still have to obtain the embed code and then paste it in your blog posts.

WordPress只能对列入白名单的视频服务进行自动嵌入。 对于其他网站,您仍然必须获取嵌入代码,然后将其粘贴到您的博客文章中。

Here is a list of white-listed video services for auto embeds in WordPress:

这是在WordPress中自动嵌入的白名单视频服务列表:

  • Amazon

    亚马孙
  • Animoto

    动画
  • Cloudup

    云上
  • CollegeHumor

    大学幽默
  • Crowdsignal

    人群信号
  • Dailymotion

    Dailymotion
  • Facebook

    脸书
  • Flickr

    Flickr
  • Hulu

    葫芦
  • Imgur

    伊姆古尔
  • Instagram

    Instagram
  • Issuu

    发行
  • Kickstarter

    Kickstarter
  • Meetup.com

    Meetup.com
  • Mixcloud

    混合云
  • Reddit

    Reddit
  • ReverbNation

    混响
  • Screencast

    截屏
  • Scribd

    刻痕
  • Slideshare

    幻灯片分享
  • SmugMug

    自鸣得意的杯子
  • Someecards

    贺卡
  • SoundCloud

    声云
  • Speaker Deck

    扬声器甲板
  • Spotify

    Spotify
  • TED

    泰德
  • Tumblr

    Tumblr
  • Twitter

    推特
  • VideoPress

    VideoPress
  • Vimeo

    Vimeo
  • WordPress.tv

    WordPress.tv
  • YouTube

    的YouTube

If you want to add a video from a website outside this list, then you will need the full HTML embed code for the video.

如果要从此列表之外的网站添加视频,则需要该视频的完整HTML嵌入代码。

Simply copy the HTML code provided by the video website and paste it inside a ‘Custom HTML’ block in the editor.

只需复制视频网站提供HTML代码,然后将其粘贴到编辑器中的“自定义HTML”块中即可。

Add a custom embed code in WordPress
使用旧的经典编辑器将视频嵌入WordPress (Embed Videos in WordPress Using Old Classic Editor)

If you are still using the old WordPress classic editor, then you can embed the videos the same way.

如果您仍在使用旧的WordPress经典编辑器 ,则可以以相同方式嵌入视频。

Simply copy the URL from a video hosting service like YouTube, and paste it in the editor. If you are using the visual editor, then you will see a preview of the video.

只需从YouTube等视频托管服务中复制URL,然后将其粘贴到编辑器中即可。 如果使用可视编辑器,则将看到视频的预览。

Emedding video in old WordPress editor

However, you will not be able to use the width adjustment and other options that you can use in the new WordPress block editor.

但是,您将无法使用在新的WordPress块编辑器中可以使用的宽度调整和其他选项。

如何在WordPress侧边栏小部件中嵌入视频 (How to Embed Videos in WordPress Sidebar Widgets)

Just like a WordPress page or post, you can also embed videos in WordPress sidebar widgets.

就像WordPress页面或帖子一样,您也可以将视频嵌入WordPress边栏小部件中。

Simply go to Appearance » Widgets page and add the ‘Text’ widget to a sidebar. See our article on how to add and use widgets in WordPress.

只需转到外观»小部件页面,然后将“文本”小部件添加到侧边栏中。 请参阅有关如何在WordPress中添加和使用小部件的文章。

Inside the widget settings, you need to paste the video URL in the content area. WordPress will automatically fetch the embed code and display the video preview.

在窗口小部件设置内,您需要将视频URL粘贴到内容区域中。 WordPress将自动获取嵌入代码并显示视频预览。

Embed videos in WordPress sidebar widget

Don’t forget to click on the ‘Save’ button to store your widget settings.

不要忘记单击“保存”按钮来存储您的小部件设置。

You can now visit your website to see the video embed in the WordPress sidebar widget.

现在,您可以访问您的网站以查看嵌入在WordPress侧边栏小部件中的视频。

为什么我不能将视频上传到WordPress? (Why can’t I upload the videos to WordPress?)

Well you can, but we do not recommend you to do so.

可以,但是我们不建议您这样做。

Most small blogs use shared WordPress hosting accounts, and videos can take up a lot of server resources. If your video got tons of traffic, then your website is more likely to crash.

大多数小型博客使用共享的WordPress托管帐户,而视频会占用大量服务器资源。 如果您的视频流量巨大,则您的网站更有可能崩溃。

Secondly, you are missing out the traffic from YouTube users.

其次,您会错过YouTube用户带来的流量。

YouTube is not only the biggest video hosting site, but it is also the world’s second most popular search engine, and the second most popular social network right after Facebook.

YouTube不仅是最大的视频托管网站,而且还是全球第二大最受欢迎的搜索引擎,并且紧随Facebook之后成为第二大最受欢迎的社交网络。

If you don’t want to upload your videos to YouTube, then you can try Vimeo or DailyMotion. See our comparison of YouTube vs Vimeo to see which platform is better for your needs.

如果您不想将视频上传到YouTube,则可以尝试使用Vimeo或DailyMotion。 查看我们对YouTube与Vimeo的比较,以了解哪个平台更适合您的需求。

For more on this topic, take a look at our article on why you should never upload a video to WordPress.

有关此主题的更多信息,请查看我们关于为什么永远不应该将视频上传到WordPress的文章

WordPress视频嵌入插件 (WordPress Video Embed Plugins)

By default, you don’t need to use a plugin to embed videos in WordPress. However, you may want to use plugins to improve video viewing experience on your website.

默认情况下,您无需使用插件即可将视频嵌入WordPress。 但是,您可能希望使用插件来改善网站上的视频观看体验。

Following are a few plugins that you may want to try.

以下是您可能想尝试的一些插件。

1. YouTube Subscribe Bar

1. YouTube订阅栏

YouTube Subscribe Bar in action

YouTube Subscribe Bar shows a YouTube subscribe button below your YouTube video embeds in WordPress. It also fetches your YouTube subscriber count to add social proof and encourage more users to subscribe.

YouTube订阅栏会在您嵌入WordPress的YouTube视频下方显示一个YouTube订阅按钮。 它还会获取您的YouTube订阅者人数,以添加社交证明并鼓励更多用户订阅。

We first created it to promote WPBeginner’s YouTube channel on this website. Many of our users asked us to share how we did this, so we decided to release it as a free plugin.

我们首先创建它是为了在此网站上宣传WPBeginner的YouTube频道 。 许多用户要求我们分享我们的操作方式,因此我们决定将其作为免费插件发布。

2. Envira Gallery

2. Envira画廊

A video gallery in WordPress

By default, WordPress does not come with embedded video gallery feature. If you wanted to show a video gallery on a page, then you’ll need a plugin to do that.

默认情况下,WordPress不附带嵌入式视频库功能。 如果要在页面上显示视频库,则需要一个插件来完成。

Envira Gallery is one of the best photo gallery plugins for WordPress. It also comes with a videos addon which allows you to create beautiful video galleries with lightbox popup support.

Envira Gallery是WordPress最好的照片库插件之一 。 它还带有一个视频插件,可让您通过灯箱弹出窗口支持创建漂亮的视频库。

3. Lazy Load for Videos

3.视频的延迟加载

Lazy load videos in WordPress

Video embeds load scripts from external websites, which has a small impact on page load speed and performance.

视频嵌入了来自外部网站的加载脚本,这对页面加载速度和性能影响很小。

Lazy Load for Videos solves this problem by only loading the video image on page load. It loads embed code only when the user clicks on the play button. See our tutorial on how to add lazy load for videos in WordPress.

视频的延迟加载通过仅在页面加载时加载视频图像来解决此问题。 仅当用户单击播放按钮时,它才会加载嵌入代码。 请参阅我们的教程,了解如何在WordPress中为视频添加延迟加载

We hope this article helped you learn how to easily embed videos in WordPress blog posts. You may also want to see our list of the must have WordPress plugins for all websites.

我们希望本文能帮助您学习如何轻松地将视频嵌入WordPress博客文章。 您可能还想查看我们所有网站都必须具有WordPress插件的列表。

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

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

翻译自: https://www.wpbeginner.com/beginners-guide/how-to-easily-embed-videos-in-wordpress-blog-posts/

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值