Inserting iFrames into WordPress posts gives you amazing flexibility, and doesn’t even require a plugin. Today we’re going over the basics on how to create your own.
What is an iFrame?
HTML iFrames are a powerful tool you can use to embed other websites inside your WordPress posts. Say you run a Youtube channel for your company, and you want to put a video in the middle of a blog post. An iFrame is a simple way to embed that video, rather than having to host it on your WordPress. This has the advantage of faster load times and a more familiar interface for users, and also helps you build up views on your YouTube channel.
It’s not just YouTube: other common choices are Facebook, Spotify, and Google Maps, but you can embed almost anything into your WordPress posts using an iFrame. You can even embed another WordPress into your WordPress and embed a WordPress into that WordPress and—
You get the point.
It’s iFrames all the way down
Creating a Manual iFrame
Even if you have a very basic HTML background, this is fairly simple. Take the following code:
and put the target link in there. You can also specify the size of the iFrame using width=”x” and height=”x”. So for example, I put this iFrame linking to our Unify CMS page into my personal blog:
You may have noticed a missing step: how did I get Unify CMS into WordPress. Don’t worry, that’s also very easy. Create or edit a post, then select the dropdown menu on the top-right. By default you’re using the Visual Editor. You want to switch to the Code Editor, then write/copy the iFrame HTML into there.
Getting an Embed Link
Many websites don’t allow you to create your own iFrames, and require you to get a link from their site. If an iFrame you’ve created manually is refusing to display, that’s probably the issue. Sites that appear frequently in iFrames will often do this so they have more control over how their content displays. Let’s look at how to get the code from some of the more common sites.
1) navigate to Share on the toolbar below the video.
2) click Embed
3) this will display the iFrame code. Ctrl+C/Command+C or simply click Copy and you’ve got it.
Find the post you want to embed and click the … menu.
You can also do this with playlists in the same way:
Find your map then click the Share button
In the box that appears, click the Embed a Map button
Copy down the link from the field that appears.
Putting It Together
Here’s a quick example I put together.
I created a specific Google Map
I went share → embed and copied the link
In WordPress, I went More Options → Code Editor
I copied the embed code into WordPress
A blog post with an embedded Google Map. It took me 30 seconds. It’s a pretty simple example, but hopefully you can see how powerful and versatile iFrames can be for your business.
A Note on Plugins
Unless you’re really struggling with the above, I do not recommend installing a plugin. Most of them rely on shortcodes (which require a very similar level of technical know-how to doing it manually) and it’s important to remember you should try to keep the number of third-party plugins on your site as low as possible. Plugins offer a lot of flexibility and power, but they can also be a huge drain on performance and they can create serious security issues; untrustworthy plugins are one of the main ways that attackers compromise WordPress sites.
That’s not to say never use plugins, but it’s important to weigh up the quality of life improvements they’re getting you versus the potential risks. WordPress Core can handle iFrames well enough that it doesn’t need any extra help. Unless there’s some very specific functionality to a particular plugin that is crucial to your site’s UX, it’s probably best to just do it yourself.
Maybe you’re looking to do something a little more involved than a simple iFrame. If you want a professional team to take your WordPress or WooCommerce page to the next level, CodeClouds have a team of over 200 professional WordPress experts you can hire. Drop us a line today!
Share this article
2.What is an iFrame?
3.Creating a Manual iFrame
4.Putting iFrames Into WordPress
5.Getting an Embed Link
How can we help?
Tell us about your inquiry and we’ll back to you as soon as we can.
Thanks for contacting us, we’ll be in touch shortly!