There may be times where you want to add supporting videos from YouTube or Vimeo into your site. Or maybe you want to add Tweets from Twitter, or content from other websites like Flickr and Instagram. You can embed these content easily in your WordPress site.
To do this, all you need to do is find the permalink for the content. In some sites like YouTube, the permalink is simply the current URL. For other sites like Reddit or Vimeo, you’ll have to find the “permalink”, “share” or “embed” button to get the URL. In some sites like Facebook, you’ll have to click the date of the status or post in order to get the permalink.
固定链接有多种形式,但通常它们看起来就像下面这样。这个来自 YouTube:
https://www.youtube.com/watch?v=dQw4w9WgXcQ
您可以将这些 URL 粘贴到内容编辑器中以嵌入内容。如果是可嵌入的,您会看到该 URL 会转换为实际的视频或内容。如果无法转换,则意味着您无法从该网站插入内容。
我可以在我的网站中嵌入哪些网站?
Not all sites can be embedded into your WordPress site. The WordPress Codex has a list of sites which you can embed: https://codex.wordpress.org/Embeds
安装插件可以添加更多可嵌入的网站
If the content you want to embed isn’t in the list in the WordPress Codex, there is another way. Installing plugins can add more embeddable sites. For example, installing Jetpack allows you to embed wall posts from Facebook.
There are plenty more out there that add more sites, do a search for “oEmbed provider” in the WordPress.org plugin repository to find more. Here’s a link to the plugin repo for your convenience: https://wordpress.org/plugins/search.php?type=term&q=oembed+provider
添加内容的另一种方法 – Iframe 嵌入代码
如果仅粘贴 URL 不起作用,还有另一种嵌入内容的方法。尝试查看您想要包含的站点的分享选项,除了固定链接之外,您可能还会获得一小段“嵌入代码”。嵌入代码看起来像这样:
<iframe width="420" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>
Copy that then in your WordPress content editor, click on the text tab on the top of the editor and paste that in. After you’ve pasted that in, head back to the visual tab, you’ll see if it works when the embed code now looks like the actual content that will get embedded. You can’t do this in the visual tab, pasting it from there would just show the pasted code in your site, it won’t get converted into the content.
使用 Page Builder Sandwich 从前端添加其他网站的内容
While adding content from other sites seem easy, doing things in the administration side of WordPress is a bit of a hassle. You have to know whether to add it in the visual tab or text tab, and you’ll have to preview your page or post in order to see how it would look like when viewed by your site’s visitors.
Page Builder Sandwich 允许您直接从前端编辑实际网站,让一切变得更加简单。使用 Page Builder Sandwich 时,您可以轻松编写和编辑网站内容。嵌入来自其他网站的内容也变得更加容易。
使用 Page Builder Sandwich,只需将固定链接或 iframe 嵌入代码粘贴到网站前端的任意位置,它就会立即转换为嵌入内容,无需再纠结需要将内容粘贴到哪个选项卡中。