Indiegogo doesn't have oEmbed, which means you can't just paste in a URL and expect it to work on a WordPress site. And worse, their directions are "Use an iframe plugin!"
NO.
Just say NO to iframe plugins!
Use a shortcode instead!
If you're brand new to shortcodes, check out Sal Ferrarello's awesome post about it (I saw him talk at WC Philly 2017 and he's amazing). I'll give you the highlights for this one code though.
The Code
/*
* Embed an IndieGoGo Campaign
*
* Usage: [indiegogo url="https://www.indiegogo.com/projects/riley-parra-season-2-lgbt"]
*
* Attributes:
* url: The URL of the project
*/
add_shortcode( 'indigogo', 'helf_indiegogo' );
function helf_indiegogo() {
$attr = shortcode_atts( array(
'url' => '',
), $atts );
$url = esc_url( $attr['url'] );
$url = rtrim( $url, "#/");
$url = str_replace( 'projects/', 'project/', $url );
$return = '<iframe src="' . $url . '/embedded" width="222px" height="445px" frameborder="0" scrolling="no"></iframe>';
return $return;
}
What It Does
The code is as basic as I could made it, and it takes the URL of the campaign, strips out the trailing hashtag, changes projects to project (singular – and yes, that gave me a headache), and punts out an iframe.
Thankfully they make this easy unlike places like CrowdRise where you have to magically know the ID number in order to pull this off.
Comments
2 responses to “Indiegogo Embed”
Just curious, why not add an oembed provider?
https://codex.wordpress.org/Function_Reference/wp_oembed_add_provider
They don’t have oembed support and I’d have to write my own handler.