Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Adds a fake/faux oEmbed provider for google fusion tables.
/* Faux Google Maps Fusiontables oEmbed
* Embed google maps in a nicer iframe without using their provided embed code
* @usage Paste a Google Maps link in your post and it will be replaced with an iframe when published
* Example embed URL:
wp_embed_register_handler( 'fusiontables_google_map', '#https://www\.google\.com/fusiontables(.*)#i', 'embed_fusiontables_google_map' );
function embed_fusiontables_google_map( $matches ) {
$query = parse_url($matches[0]);
parse_str($query['query'], $qvars);
$width = isset($qvars['w']) ? $qvars['w'] : 620;
$height = isset($qvars['w']) ? $qvars['h'] : 450;
$embed = '<div class="flex-video"><iframe class="google-map" width="'.$width.'" height="'.$height.'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.$matches[0].'"></iframe></div>';
return apply_filters( 'embed_gft_map', $embed );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment