Tutorial: Loading your SlideDecks via iframes (aka the almost-silver bullet)15 Comments
We all love our WordPress plugins, but make no mistake – making them work for everyone can be a hairy beast. Each plugin developer has no control over how their user’s theme is coded, or which other developers’ plugins & scripts are being loaded, and how they behave. Given the openness of the WordPress community, it’s to be expected, but sometimes these external factors can conflict with each other to produce…interesting results…
Sometimes theme or script conflicts can prevent SlideDeck 2 from appearing and functioning as it should, right out of the box. Thankfully, we recognized this pretty early on in our internal testing, and we implemented an awesome little feature that can nip the majority of these issues in the bud – by loading them in iframes.
Already know about iframes? Skip straight to the code, below.
i-What?? Is this an Apple product?
No, no, no – iframes have been around a lot longer than the shiny white products of Jobsian heritage. They’re essentially mini web pages that are displayed within a window embedded in the surrounding parent page. Although you may not recognize them, you’ve definitely seen them around: Facebook Like buttons, Twitter search boxes and YouTube videos – all of these commonly-used social web elements are actually embedded in pages using iframes
So why is this helpful to us?
Ok, I’m sold. How do I embed my SlideDeck inside an iframe?
Are you ready for this? We have two different ways to do it. Don’t worry, this won’t hurt a bit!
1. To embed a single SlideDeck inside an iframe: Simply add the parameter “iframe=1“ into the shortcode you used to embed the SlideDeck in your post or page – here are a couple examples:
[SlideDeck2 id=XXXX iframe=1]
<?php echo do_shortcode( '[SlideDeck2 id=XXXX iframe=1]' ); ?>
To embed all SlideDecks inside iframes, moving forward: Under “SlideDeck 2 » Advanced Options“, toggle the “Include the “iframe=1” attribute in all new shortcode embeds by default” option to ON (this will not affect any already inserted SlideDeck shortcodes, so you will need to go back and modify those)
What about SEO? Aren’t iframes, like, the devil when it comes to search rankings?
It depends what you’re going for. Google does actually crawl the content and links contained inside iframes, and gives credit to the originating page. This means that embedding your SlideDeck inside an iframe will confer no SEO benefit to the page you embed them on. The good news, however, is that your SlideDecks all reside locally on your WordPress installation, so your overall site will still be credited as the source of the content.
Hopefully that gives you a good understanding of our ‘silver bullet’ solution for script and styling conflicts. Still got questions? Let us know in the comments!